-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bybit V5 #4771
Bybit V5 #4771
Conversation
87a4c74
to
ddf8337
Compare
please approve this PR |
@damiano1996 |
Hello @damiano1996 I think it’s worth it in the case of linear contract.
since it is now implemented in Okx, Binance and others... what do you think? |
Hi @rizer1980, thanks for your feedbacks. I'll look into it in the next days. |
Hi @rizer1980 I updated the code following your suggestions. ExchangeSpecification exchangeSpecification =
new BybitExchange().getDefaultExchangeSpecification();
exchangeSpecification.setApiKey(System.getenv("apiKey"));
exchangeSpecification.setSecretKey(System.getenv("secretKey"));
exchangeSpecification.setExchangeSpecificParametersItem(
SPECIFIC_PARAM_ACCOUNT_TYPE, BybitAccountType.UNIFIED); // or FUND
BybitExchange bybitExchange =
(BybitExchange) ExchangeFactory.INSTANCE.createExchange(exchangeSpecification);
System.out.println(
"Wallets: " + bybitExchange.getAccountService().getAccountInfo().getWallets());
System.out.println(
"Ticker: "
+ bybitExchange
.getMarketDataService()
.getTicker(new FuturesContract(CurrencyPair.BTC_USD, "PERP")));
System.out.println("Instruments:");
bybitExchange
.getExchangeMetaData()
.getInstruments()
.forEach(
(instrument, instrumentMetaData) ->
System.out.println(instrument + " -> " + instrumentMetaData));
String marketSpotOrderId =
bybitExchange
.getTradeService()
.placeMarketOrder(
new MarketOrder(OrderType.BID, new BigDecimal("10"), CurrencyPair.BTC_USDT));
System.out.println("Market SPOT order id: " + marketSpotOrderId);
System.out.println("Orders: " + bybitExchange.getTradeService().getOrder(marketSpotOrderId)); Now, Bybit categories are inferred from the instrument type. Eg. Market orders as above are converted to spot. I tried to execute a limit order using |
Hi @damiano1996 I think sooner or later we will figure this out. |
Hi @damiano1996 Sample, based on filter "baseCoin": "ETH"
I'm at a loss as to how to correctly name these missing instruments. ( |
Hi @rizer1980 , sorry for late answer. I fixed the issue by exploiting the |
@douggie |
Can anyone confirm that this is, in fact, working? I am getting the params error: symbol invalid as @damiano1996 mentioned above. I get it even when I execute the underlying call to ByBit with the symbol format that ByBit has in its official documentation, as can be seen in the following screenshots: |
Spot - works.
|
I confirm that Spot functionality is operational. For the Futures issue, I've filed a new bug report here: Issue #4822 |
Bybit V5 API
Upgrade to API v5 for Bybit.
Example