Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get new USDT pair position from Bybit #6827

Closed
antebw opened this issue Apr 21, 2020 · 20 comments
Closed

How to get new USDT pair position from Bybit #6827

antebw opened this issue Apr 21, 2020 · 20 comments
Assignees
Labels

Comments

@antebw
Copy link

antebw commented Apr 21, 2020

exchange.private_get_position_list({"symbol": 'BTCUSD'}))['result'] works perfectly for inverse perpetual but how to get position for USDT perpertual. ?

/private/linear/position/list .....this is from offical Bybit api but doesnt work for me
thy

@kroitor kroitor self-assigned this Apr 21, 2020
@kroitor
Copy link
Member

kroitor commented Apr 21, 2020

but how to get position for USDT perpertual. ?

It's the same as with BTCUSD, just change it for BTCUSDT:

exchange.private_get_position_list({"symbol": 'BTCUSDT'}))['result']

Let me know if that does not answer the question.

@kroitor kroitor closed this as completed Apr 21, 2020
@antebw
Copy link
Author

antebw commented Apr 21, 2020

Am geting this error when change symbol to BTCUSDT pair

ccxt.base.errors.ExchangeError: bybit {"ret_code":10001,"ret_msg":"Param validation for 'symbol' failed on the 'symbol' tag","ext_code":"","ext_info":"","result":null,"time_now":"1587487589.956804","rate_limit_status":119,"rate_limit_reset_ms":1587487589956,"rate_limit":120}

@kroitor
Copy link
Member

kroitor commented Apr 21, 2020

@antebw yes, I am also having that error. Unfortunately, it's not documented in the API docs... you might want to forward this question to ByBit tech support. It will be awesome if you let us know whether you have an answer from them or not – we will add the necessary workarounds on our side as well. Thx for reporting it!

@kroitor
Copy link
Member

kroitor commented Apr 21, 2020

@antebw I suspect, since BTCUSDT has been added 4 days ago, it may be unavailable with all the endpoints yet: https://bybit-exchange.github.io/docs/inverse/#t-changelog

@kroitor kroitor reopened this Apr 21, 2020
@antebw
Copy link
Author

antebw commented Apr 21, 2020

/private/linear/position/list this is the end point for BTCUSDT
and this ones /private/position/list is for BTCUSD i guess difference is there

@kroitor
Copy link
Member

kroitor commented Apr 21, 2020

@antebw yep, found the updated docs here: https://bybit-exchange.github.io/docs/linear/#t-marketdata

Will add that shortly. Stay tuned.

@antebw
Copy link
Author

antebw commented Apr 21, 2020

Thank you mate

@kroitor
Copy link
Member

kroitor commented Apr 21, 2020

This API design with a separate "linear" keyword in the URL is really making the life of developers hard. They should've just added it as a "yet another" pair. But we will try to add the workarounds for it...

@antebw
Copy link
Author

antebw commented Apr 21, 2020

Ok mate let me know when you do it. I appreciate your work.

@kroitor
Copy link
Member

kroitor commented Apr 21, 2020

@antebw please, update your CCXT to version 1.26.66 and use this code to get your USDT position:

exchange.privateLinear_get_position_list({"symbol": 'BTCUSDT'}))['result']

or

exchange.privateLinearGetPositionList({"symbol": 'BTCUSDT'}))['result']

We will be happy if you report back whether it works for you or not. Thx again!

kroitor added a commit that referenced this issue Apr 21, 2020
@antebw
Copy link
Author

antebw commented Apr 21, 2020

It's working like a charm. Thank you very much, if i find anything more , will report.

@homily
Copy link

homily commented Apr 25, 2020

hi kroitor , when i use the symbol 'btc/usdt' to get OHLCV it error

import ccxt
from pprint import pp


bybit=ccxt.bybit()



Markets=bybit.fetchMarkets()

[pp( Markets[x]['symbol']) for x in range(len(Markets))]

pp(bybit.fetchL2OrderBook('BTC/USDT'),depth=1)

data=bybit.fetchOHLCV('BTC/USDT','15m',None,1)

return

ccxt.base.errors.ExchangeError: bybit {"ret_code":10001,"ret_msg":"Param validation for 'symbol' failed on the 'symbol' tag","ext_code":"","ext_info":"","result":null,"time_now":"1587805088.704864"}

but when i use fetchL2OrderBook it's ok

oh, how can i get it ?

@kroitor

@kroitor
Copy link
Member

kroitor commented Apr 25, 2020

@homily hi! What's your CCXT version? Do you have the same issue with the newest version?

@kroitor
Copy link
Member

kroitor commented Apr 25, 2020

@homily the linear perpetual BTC/USDT has been added by ByBit not so long ago, and CCXT has been updated accordingly at that time. Let us know if you have issues with it or not after upgrading your CCXT version. Thx!

@homily
Copy link

homily commented Apr 25, 2020

@kroitor my ver is 1.26.45,, but i used 'pip install -u ccxt' ..

oh no,

now it work.... it's my wrong ,,, thanks

@homily
Copy link

homily commented Apr 26, 2020

@kroitor

hi,kroitor
i have something error, can you halp me?

my version is 1.26.98

when i use ccxt.bybit to get OHLCV with the symbol 'btc/usdt'
the 'BTC/USDT' first return start_at an end is None

code is

import ccxt
from pprint import pp
import pandas as pd
bybit=ccxt.bybit()

data=bybit.fetchOHLCV('BTC/USD','15m',None,1)
print(data)

data=bybit.fetchOHLCV('BTC/USDT','15m',None,1)
print(data)

return is

===================== RESTART: C:\Users\homily\Desktop\bybit_usdt.py ====================
[[1587882600000, 7550.0, 7550.0, 7549.5, 7549.5, 18.14837269]]
[['start_at', 7545.5, 7546.0, 7545.5, 7545.5, None]]

the 'BTC/USDT' first return start_at an end is None

it's wrong? thanks.

@kroitor
Copy link
Member

kroitor commented Apr 26, 2020

@homily hi! Yes, indeed there was a bug there (ByBit returns a different format of OHLCV for linear perpetuals, sic!). Thx for reporting it! I've uploaded a fix for it, it will become available in CCXT version 1.26.99 in 15 minutes. Please, update your version again after a short while and let us know if that resolves the issue for you or not. Looking forward to hearing from you!

@homily
Copy link

homily commented Apr 26, 2020

@kroitor hi kroitor, now i can use it.thanks.

sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
sirinn pushed a commit to bitpanda-labs/ccxt that referenced this issue May 11, 2020
@owneroxxor
Copy link

Shitty 'linear' keyword lol. bybit has a terrible API design, really

@kroitor
Copy link
Member

kroitor commented Dec 12, 2020

@owneroxxor yeah, i wonder why not just serve all inverse and linear markets at once under a unified url schema, why split the endpoints at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants