mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-29 15:10:37 +00:00
exchanges/futures: Implement open interest (#1417)
* adds open interest to exchanges * ADDS TESTING YEAH * New endpoints, BTSE, RPCS, cached * slight design change, begin gateio You will need to get cached for each exchange that supports it * gateio, huobi, rpc * fix up kraken, cache retrieval * okx, gateio * finalising all implementations and tests * definitely my final ever commit on this * Well, well, well * final v2 * quick fix of bug * test coverage, assert notempty, test helper Added a new testhelper for currency management because its very annoying in a parallel test setting which wastes so much space otherwise * minimises REST requests for Open Interest * types.Number merge misses * Minimises Kraken REST calls * len change, value -> pointer receiver * further fixup * fixes gateio, batch calculates open interest * single gateio, lint const fixes * rejig and more thorough oi for huobi * formatting expansion * minor fix for handling expiring contracts * rm unused Binance strings * add bybit support, fix bybit issues * oopsie doopsie, dont look at my whoopsie * Fix issue, remove feature * move an irrelevant function for the pr * mini bybit upgrades * fixes cli request bug
This commit is contained in:
@@ -71,6 +71,7 @@ const (
|
||||
LongDated
|
||||
Weekly
|
||||
Fortnightly
|
||||
ThreeWeekly
|
||||
Monthly
|
||||
Quarterly
|
||||
SemiAnnually
|
||||
@@ -91,6 +92,8 @@ func (c ContractType) String() string {
|
||||
return "weekly"
|
||||
case Fortnightly:
|
||||
return "fortnightly"
|
||||
case ThreeWeekly:
|
||||
return "three-weekly"
|
||||
case Monthly:
|
||||
return "monthly"
|
||||
case Quarterly:
|
||||
|
||||
@@ -199,6 +199,12 @@ type CollateralCalculator struct {
|
||||
UnrealisedPNL decimal.Decimal
|
||||
}
|
||||
|
||||
// OpenInterest holds open interest data for an exchange pair asset
|
||||
type OpenInterest struct {
|
||||
Key key.ExchangePairAsset
|
||||
OpenInterest float64
|
||||
}
|
||||
|
||||
// PNLCalculator implements the PNLCalculation interface
|
||||
// to call CalculatePNL and is used when a user wishes to have a
|
||||
// consistent method of calculating PNL across different exchanges
|
||||
|
||||
Reference in New Issue
Block a user