def GetOrder(api_key, api_secret, orders_id):

        homiex = BrokerContractClient(entry_point=MyExchange.tread_url,
                                      api_key=api_key,
                                      secret=api_secret)
        raw_data = homiex.get_order('LIMIT', order_id=orders_id)

        if 'error' in raw_data.keys():
            return {
                'error':
                json.dumps(raw_data['error'],
                           encoding="utf8",
                           ensure_ascii=False)
            }
        if 'orderId' in raw_data:
            ret_data = {
                "data": {
                    "id": raw_data['orderId'],
                    "amount": raw_data['origQty'],
                    "price": raw_data['price'],
                    "status": raw_data['status'],
                    "type": raw_data['side'],
                },
                'raw': raw_data
            }
        else:
            ret_data = {"data": {}}

        return ret_data
Beispiel #2
0
                             clientOrderId=int(time.time()),
                             side='BUY_OPEN',
                             orderType='LIMIT',
                             quantity='2',
                             price='8000',
                             leverage='10',
                             timeInForce='GTC',
                             triggerPrice=None)

        print(result)

        order_id = result['orderId']

        print(order_id)

        print(b.get_order('LIMIT', order_id=order_id))

        print(b.order_cancel(order_id=order_id))

        print(b.open_orders(order_type='LIMIT'))

        print(b.history_orders())

        print(b.account())

        print(b.my_trades())

        listen_key = b.stream_get_listen_key()

        print(listen_key)