Binance,Okx: Add Leverage, MarginType, Positions and CollateralMode support (#1220)

* init

* surprise train commit

* basic distinctions

* the terms of binance are confusing

* renames and introduction of allocatedMargin

* add new margin funcs

* pulling out wires

* implement proper getposition stuff

* bad coding day

* investigate order manager next

* a broken mess, but a progressing one

* finally completes some usdtmargined stuff

* coinMfutures eludes me

* expand to okx

* imports fix

* completes okx wrapper implementations

* cleans and polishes before rpc implementations

* rpc setup, order manager features, exch features

* more rpc, collateral and margin things

* mini test

* looking at rpc response, expansion of features

* reorganising before the storm

* changing how futures requests work

* cleanup and tests of cli usage

* remove silly client side logic

* cleanup

* collateral package, typo fix, margin err, rpc derive

* uses convert.StringToFloat ONLY ON STRUCTS FROM THIS PR

* fix binance order history bug

* niteroos

* adds new funcs to exchange standards testing

* more post merge fixes

* fix binance

* replace simepletimeformat

* fix for merge

* merge fixes

* micro fixes

* order side now required for leverage

* fix up the rest

* global -> portfolio collateral

* Update exchanges/collateral/collateral_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* adds fields and todos

* rm field redundancy

* lint fix oopsie daisy

* fixes panic, expands error and cli explanations (sorry shaz)

* ensures casing is appropriate for underlying

* Adds a shiny TODO

---------

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
Scott
2023-09-26 16:16:31 +10:00
committed by GitHub
parent a2ae99ed7f
commit 5f2f6f884b
67 changed files with 11558 additions and 4475 deletions

View File

@@ -262369,6 +262369,38 @@
},
"/dapi/v1/fundingRate": {
"GET": [
{
"data": [
{
"fundingRate": "0.00010000",
"fundingTime": 1605513600010,
"symbol": "BTCUSD_PERP"
},
{
"fundingRate": "0.00025141",
"fundingTime": 1605542400000,
"symbol": "BTCUSD_PERP"
},
{
"fundingRate": "0.00010000",
"fundingTime": 1605571200000,
"symbol": "BTCUSD_PERP"
},
{
"fundingRate": "0.00010000",
"fundingTime": 1605600000000,
"symbol": "BTCUSD_PERP"
},
{
"fundingRate": "0.00010000",
"fundingTime": 1605628800008,
"symbol": "BTCUSD_PERP"
}
],
"queryString": "endTime=1580515200000&limit=1000&startTime=1577836800000&symbol=BTCUSD_PERP",
"bodyParams": "",
"headers": {}
},
{
"data": [
{
@@ -272474,7 +272506,7 @@
"time": 1679280568770
}
],
"queryString": "limit=1000\u0026symbol=BTCUSD_PERP",
"queryString": "limit=5\u0026symbol=BTCUSD_PERP",
"bodyParams": "",
"headers": {}
},
@@ -272521,7 +272553,7 @@
"time": 1607294297101
}
],
"queryString": "limit=5\u0026symbol=BTCUSD_PERP",
"queryString": "limit=1000\u0026symbol=BTCUSD_PERP",
"bodyParams": "",
"headers": {}
}
@@ -331195,6 +331227,53 @@
"queryString": "limit=5\u0026symbol=BTCUSDT",
"bodyParams": "",
"headers": {}
},
{
"data": [
{
"id": 3947543021,
"isBuyerMaker": false,
"price": "30114.70",
"qty": "0.002",
"quoteQty": "60.22",
"time": 1689636431983
},
{
"id": 3947544017,
"isBuyerMaker": false,
"price": "30110.00",
"qty": "0.002",
"quoteQty": "60.22",
"time": 1689636508583
},
{
"id": 3947544018,
"isBuyerMaker": false,
"price": "30110.00",
"qty": "0.001",
"quoteQty": "30.11",
"time": 1689636508583
},
{
"id": 3947544019,
"isBuyerMaker": false,
"price": "30110.00",
"qty": "0.347",
"quoteQty": "10448.17",
"time": 1689636508583
},
{
"id": 3947544020,
"isBuyerMaker": false,
"price": "30110.00",
"qty": "0.090",
"quoteQty": "2709.90",
"time": 1689636508658
}
],
"queryString": "limit=1000\u0026symbol=BTCUSDT",
"bodyParams": "",
"headers": {}
}
]
},