Пример #1
0
 def order_buy(self):
     oe = OrderEngine
     if self.order_type.get() == 'market':
         oe.market(OrderEngine, round(get_account_value(), 2), self.get_last_price())
     if self.order_type.get() == 'limit':
         print('LIMIT BIMIT ORDER HEHEH')
         oe.limit(OrderEngine, round(get_account_value(), 2), float(self.limit_price.get()), self.get_last_price())
     self.update_labels()
Пример #2
0
 def order_sell(self):
     oe = OrderEngine
     if self.order_type.get() == 'market':
         print(type(get_account_value()), type(self.get_last_price()))
         oe.market(OrderEngine, round(get_account_value(), 2) * -1, float(self.get_last_price()))
     if self.order_type.get() == 'limit':
         oe.limit(OrderEngine, get_account_value() * -1, float(self.limit_price.get()), self.get_last_price())
     self.update_labels()
Пример #3
0
    def update_labels(self):

        # update all labels via tk StringVar()
        self.last_price_value.set(str(self.get_last_price()))
        self.current_position_pnl.set(str(self.get_position_pnl()) + '%')
        self.account_value_pnl.set(str(round(percent_change(get_account_value(), float(config.initial_amount)), 2)) + '%')
        self.current_position_value.set(str(get_position()['quantity']) + " @ " + str(get_position()['entry']))
        self.account_value_text.set(locale.currency(get_account_value(), grouping=True))
        self.ticker_value.set(self.get_ticker())

        # Update trade history box
        self.trade_history_list.delete(0, 'end')
        for trade in read_all():
            self.trade_history_list.insert(0, trade)