FTX: Margin lending/borrow rate history (#981)

* Adds lending rates/borrows to FTX and the command

* Movements, renames, rpc test

* Fleshing out rpc response

* Allows rpcserver to calculate offline (but not gctcli). Expands tests

* rn structs. add exchange_wrapper_issues support

* Adds a nice yearly rate

* Surprise yearly borrow rate!

* Rn+Mv to margin package. Fixes some serious whoopsies

* Adds average lend/borrow rates instead of sum

* rm oopsie whoopsie

* This is what the linter was having an issue with

* re-gen

* lintl

* niteroos
This commit is contained in:
Scott
2022-07-12 14:27:35 +10:00
committed by GitHub
parent e02053a2d6
commit bed9425a08
21 changed files with 3135 additions and 989 deletions

View File

@@ -2176,6 +2176,102 @@
]
}
},
"/v1/getmarginrateshistory": {
"get": {
"operationId": "GoCryptoTraderService_GetMarginRatesHistory",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/gctrpcGetMarginRatesHistoryResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "exchange",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "asset",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "currency",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "startDate",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "endDate",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "getPredictedRate",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "getLendingPayments",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "getBorrowRates",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "getBorrowCosts",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "includeAllRates",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "calculateOffline",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "takerFeeRate",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"GoCryptoTraderService"
]
}
},
"/v1/getorder": {
"post": {
"operationId": "GoCryptoTraderService_GetOrder",
@@ -3888,6 +3984,17 @@
}
}
},
"gctrpcBorrowCost": {
"type": "object",
"properties": {
"cost": {
"type": "string"
},
"size": {
"type": "string"
}
}
},
"gctrpcCancelAllOrdersRequest": {
"type": "object",
"properties": {
@@ -5001,6 +5108,42 @@
}
}
},
"gctrpcGetMarginRatesHistoryResponse": {
"type": "object",
"properties": {
"rates": {
"type": "array",
"items": {
"$ref": "#/definitions/gctrpcMarginRate"
}
},
"totalRates": {
"type": "string",
"format": "int64"
},
"sumBorrowCosts": {
"type": "string"
},
"avgBorrowSize": {
"type": "string"
},
"sumLendingPayments": {
"type": "string"
},
"avgLendingSize": {
"type": "string"
},
"latestRate": {
"$ref": "#/definitions/gctrpcMarginRate"
},
"predictedRate": {
"$ref": "#/definitions/gctrpcMarginRate"
},
"takerFeeRate": {
"type": "string"
}
}
},
"gctrpcGetOrderRequest": {
"type": "object",
"properties": {
@@ -5178,6 +5321,17 @@
}
}
},
"gctrpcLendingPayment": {
"type": "object",
"properties": {
"payment": {
"type": "string"
},
"size": {
"type": "string"
}
}
},
"gctrpcListOfSignals": {
"type": "object",
"properties": {
@@ -5190,6 +5344,35 @@
}
}
},
"gctrpcMarginRate": {
"type": "object",
"properties": {
"time": {
"type": "string"
},
"marketBorrowSize": {
"type": "string"
},
"hourlyRate": {
"type": "string"
},
"yearlyRate": {
"type": "string"
},
"hourlyBorrowRate": {
"type": "string"
},
"yearlyBorrowRate": {
"type": "string"
},
"lendingPayment": {
"$ref": "#/definitions/gctrpcLendingPayment"
},
"borrowCost": {
"$ref": "#/definitions/gctrpcBorrowCost"
}
}
},
"gctrpcModifyOrderResponse": {
"type": "object",
"properties": {