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

FIX: [bitget] use new size instead of size #1542

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

bailantaotao
Copy link
Collaborator

Bitget API changelog

https://www.bitget.com/api-doc/common/changelog
The spot order channel push now includes a new parameter newSize, which will gradually replace the existing parameter size in subsequent updates.

newSize represents the order quantity, following the specified rules:

when orderType=limit, newSize represents the quantity of base coin,
when orderType=market and side=buy, newSize represents the quantity of quote coin,
when orderType=market and side=sell, newSize represents the quantity of base coin

Unexpected Size field

The size filed is unexpected on limit buy order. it represents the size * volume. This is different from what was previously tested.

The order placed a limit buy at price 1.6 and size 5.6756, but the websocket returned size 9.0809.

[{"instId":"APEUSDT","orderId":"1144801703390253056","clientOid":"8d9160a6-69a6-46e6-b6bf-41f77a869c7e","price":"1.6000","size":"9.0809","newSize":"5.6756","notional":"9.080960","orderType":"limit","force":"gtc","side":"buy","accBaseVolume":"0.0000","priceAvg":"0.0000","status":"live","cTime":"1708667916152","uTime":"1708667916152","feeDetail":[],"enterPointSource":"WEB"}]

The raw data above is displayed in the web console.
image

Other data filed in size and newSize is expected.

when orderType=limit, and side = sell, newSize and size represents the quantity of base coin,

[{"instId":"APEUSDT","orderId":"1144800668517044224","clientOid":"b540604a-21a3-40d6-9655-ee42e2db41f7","price":"1.6800","size":"3.3000","newSize":"3.3000","orderType":"limit","force":"gtc","side":"sell","accBaseVolume":"0.0000","priceAvg":"0.0000","status":"cancelled","cTime":"1708667669419","uTime":"1708667676652","feeDetail":[],"enterPointSource":"WEB"}]

when orderType=market and side=buy, newSize and size represents the quantity of quote coin,

[{"instId":"APEUSDT","orderId":"1144800468134170630","clientOid":"d0f595a1-482f-46f6-8bac-02b88052b5f1","size":"5.5000","newSize":"5.5000","notional":"5.500000","orderType":"market","force":"gtc","side":"buy","accBaseVolume":"0.0000","priceAvg":"0.0000","status":"live","cTime":"1708667621644","uTime":"1708667621644","feeDetail":[],"enterPointSource":"WEB"}]

when orderType=market and side=sell, newSize and size represents the quantity of base coin

[{"instId":"APEUSDT","orderId":"1144800723705696258","clientOid":"5bbf35af-c8e6-491b-ac38-55f2ee9e1e70","size":"3.3114","newSize":"3.3114","orderType":"market","force":"gtc","side":"sell","accBaseVolume":"0.0000","priceAvg":"0.0000","status":"live","cTime":"1708667682577","uTime":"1708667682577","feeDetail":[],"enterPointSource":"WEB"}]

@bbgokarma-bot
Copy link

Welcome back! @bailantaotao, This pull request may get 218 BBG.

Copy link

codecov bot commented Feb 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 21.77%. Comparing base (06c533f) to head (5c75095).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1542   +/-   ##
=======================================
  Coverage   21.77%   21.77%           
=======================================
  Files         606      606           
  Lines       43940    43940           
=======================================
  Hits         9566     9566           
  Misses      33692    33692           
  Partials      682      682           
Files Coverage Δ
pkg/exchange/bitget/convert.go 91.73% <100.00%> (ø)
pkg/exchange/bitget/types.go 51.64% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06c533f...5c75095. Read the comment docs.

@bailantaotao bailantaotao merged commit 541496f into main Feb 23, 2024
5 checks passed
@bailantaotao bailantaotao deleted the edwin/bitget/update-api branch February 23, 2024 07:46
@bbgokarma-bot
Copy link

Hi @bailantaotao,

Well done! 228 BBG has been sent to your polygon wallet. Please check the following tx:

https://polygonscan.com/tx/0xb79f4da8870061f88a77a73155460369d21b8c944880918fbe992ccf48391581

Thank you for your contribution!

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

Successfully merging this pull request may close these issues.

3 participants