bitfinexcom / bitfinex-api-py

Apache License 2.0
200 stars 125 forks source link

Unable to create order on paper account: [ERROR] Notification ERROR: action: disabled #212

Closed ahfx closed 1 year ago

ahfx commented 1 year ago

Issue type

Brief description

I am following examples from this project README, trying to create an order with an API key from my paper trading account. Creating an order with the websocket client and rest client results in: [ERROR] Notification ERROR: action: disabled

Steps to reproduce

- Setup API on paper account with the following permissions:

image

Use the following snippet to execute order:

bfx = Client(
    API_KEY='MY_API_KEY',
    API_SECRET='MY_API_SECRET',
    logLevel='DEBUG'
)

@bfx.ws.on('authenticated')
async def submit_order(auth_message):
    await bfx.ws.submit_order(symbol='tTESTBTCTESTUSD', price=10000, amount=0.001, market_type=Order.Type.MARKET)

bfx.ws.run()
Additional Notes:

-

Console Output:

[BfxWebsocket] [INFO] Authentication successful.
[BfxOrderManager] [INFO] Order cid=1669736274982 (tTESTBTCTESTUSD 0.001 @ 16089) dispatched
[BfxWebsocket] [DEBUG] [0,"ps",[["tTESTBTC:TESTUSD","ACTIVE",0.001,16089,0,0,null,null,null,null,null,157769708,null,null,null,0,null,0,null,{"reason":"TRADE","order_id":109234966211,"order_id_oppo":109356782556,"liq_stage":null,"trade_price":"16089.0","trade_amount":"0.001","order_cid":1669651752358,"order_gid":null}]]]
[BfxWebsocket] [DEBUG] [0,"ws",[["margin","TESTBTC",0.5,0,null,null,null],["margin","TESTUSD",-0.032178,0,null,"Trading fees for 0.001 TESTBTC (TESTBTC:TESTUSD) @ 16089.0 on BFX (0.2%)",null]]]
[BfxWebsocket] [DEBUG] [0,"os",[]]
[BfxWebsocket] [DEBUG] [0,"fos",[]]
[BfxWebsocket] [INFO] Funding offer snapshot: [0, 'fos', []]
[BfxWebsocket] [DEBUG] [0,"fcs",[]]
[BfxWebsocket] [INFO] Funding credit snapshot: [0, 'fcs', []]
[BfxWebsocket] [DEBUG] [0,"fls",[]]
[BfxWebsocket] [INFO] Funding loan snapshot: [0, 'fls', []]
[BfxWebsocket] [DEBUG] [0,"wu",["margin","TESTBTC",0.5,0,0.4996149876075942,null,null]]
[BfxWebsocket] [INFO] Wallet update: Wallet <'margin_TESTBTC' balance='0.5' balance_available='0.4996149876075942' unsettled='0'>
[BfxWebsocket] [DEBUG] [0,"n",[1669736275133,"on-req",null,null,[null,null,1669736274982,"tTESTBTCTESTUSD",null,null,0.001,null,"MARKET",null,null,null,0,null,null,null,16089,null,0,0,null,null,null,0,0,null,null,null,null,null,null,{}],null,"ERROR","action: disabled"]]
[BfxOrderManager] [INFO] Deleted Order CID 1669736274982 from pending orders
[BfxWebsocket] [ERROR] Notification ERROR: action: disabled
ahfx commented 1 year ago

The issue was with my symbol syntax:

tTESTBTCTESTUSD should be tTESTBTC:TESTUSD

But this does conflict with the Quick start example:

@bfx.ws.on('authenticated')
async def submit_order(auth_message):
  await bfx.ws.submit_order('tBTCUSD', 19000, 0.01, Order.Type.EXCHANGE_MARKET)

bfx.ws.run()

Otherwise I no longer have an issue