HI
I am using ccxt
library to place a market order. Since I am new so unsure how’d I know if my order was successfully placed and then execute. Below is the code"
if __name__ == '__main__':
exchange_id = 'binance'
API_KEY = ''
SECRET = ''
exchange_class = getattr(ccxt, exchange_id)
symbol = 'BTC/USDT'
type = 'market' # or 'market'
side = 'buy' # or 'buy'
amount = 1.0
price = 49000 # or None
# extra params and overrides if needed
params = {
'test': True, # test if it's valid, but don't actually place it
}
exchange = ccxt.binance({
'apiKey': API_KEY,
'secret': SECRET,
'enableRateLimit': True,
})
exchange.set_sandbox_mode(enabled=True)
order = exchange.create_order(symbol, type, side, amount, price, params)
print(order)
It gave the following output:
{
'info': {
},
'id': None,
'clientOrderId': None,
'timestamp': None,
'datetime': None,
'lastTradeTimestamp': None,
'symbol': 'BTC/USDT',
'type': None,
'timeInForce': None,
'postOnly': False,
'side': None,
'price': None,
'stopPrice': None,
'amount': None,
'cost': None,
'average': None,
'filled': None,
'remaining': None,
'status': None,
'fee': None,
'trades': None
}
Sorry for the dumb question.