roq-trading / roq-issues

Issue tracker for Roq's software solutions.
https://roq-trading.com/
1 stars 0 forks source link

[roq-bybit] accountType only support UNIFIED and CONTRACT #463

Closed damian123 closed 3 months ago

damian123 commented 3 months ago

The roq-bybit gateway gives me an error in the log file

L0 order_entry.cpp:385] Unexpected: message="{"retCode":10001,"retMsg":"accountType only support UNIFIED and CONTRACT.","result":{},"retExtInfo":{},"time":1718850626966}"
 L0 controller.cpp:168] *** SIGNAL: INTERRUPT ***

I think this means that the argument to the accountType in the ByBit API request should be et to either "UNIFIED" or "CONTRACT".

I am use the bybit testnet api key and start the gw like this

roq-bybit \
    --name "bybit" \
    --config_file ~/bybit.toml \
    --client_listen_address ~/bybit.sock
$roq-bybit --version 
1.0.1%                                    
thraneh commented 3 months ago

This error message appears to be the exchange's response to this API request

You can verify what the gateway is sending like this

ROQ_v=5 roq-bybit [...] | grep wallet-balance

And you will see something like this

I0620 05:27:16.224625 97781 L4 client.cpp:194] request_id="account-wallet-balance", message="GET /v5/account/wallet-balance?accountType=SPOT HTTP/1.1

You will notice the accountType field is being sent as a query parameter. (You can see the full request if you pipe the output to file and search for wallet-balance, the request body is logged right after.)

A problem, from looking at your command-line, is that you're not being explicit about using flags and instead relying on defaults.

You should at a minimum be explicit about the API you're using (spot, liner, ...), i.e. the --api flag that you see here

You should also be explicit about the URI's for connecting to the new unified API. Normally you would use --flagfile=$CONDA_PREFIX/share/roq-bybit/flags/test/flags.cfg as you can verify from here

The default URI's should be fine for Bybit's testnet, though.

So I have a feeling that the real issue is about configuring your account (on the exchange) as a unified trading account (UTA)?

Finally, this is not the proper medium for supporting configuration issues. You should reach out on info@roq-trading.com if you're interested in licensing the software.

damian123 commented 3 months ago

Thank you @thraneh I had to tell it that I am using the linear futures and be explicit about the ws and rest URIs.

ROQ_v=5  roq-bybit \
    --name "bybit" \
    --config_file ~/bybit.toml \
    --client_listen_address ~/bybit.sock --rest_uri=https://api-testnet.bybit.com \
    --ws_public_uri=wss://stream-testnet.bybit.com/v5/public \
    --ws_private_uri=wss://stream-testnet.bybit.com/v5/private \
    --api linear | grep grep wallet-balance

I then get the UNIFIED accountType set as expected

L4 client.cpp:206] request_id="account-wallet-balance", message="GET /v5/account/wallet-balance?accountType=UNIFIED HTTP/1.1