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

exchanges: Okx Update #1420

Open
wants to merge 164 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 162 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
1c049bb
update acccount ratelimits and added missing endpoints
samuael Nov 7, 2023
5ba4043
completed mapping missing trade accoung REST endpoints and Rate Limit
samuael Nov 8, 2023
57ebd02
added orderbook trading missing REST endpoints
samuael Nov 10, 2023
372a0be
Added few missing endpoints and unit tests
samuael Nov 11, 2023
b448b2d
Completed grid trading and signal bot trading with unit tests
samuael Nov 12, 2023
c8ec145
Added Recurring Buy endpoints and corresponding unit tests
samuael Nov 13, 2023
de333e1
Added copy trading endpoints and unit tests
samuael Nov 14, 2023
474b7ee
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 15, 2023
5e44c1c
added newly added block trading and spread endpoints
samuael Nov 17, 2023
b25bca0
completed mapping spread endpoints
samuael Nov 18, 2023
6444789
Added new endpoints and unit tests
samuael Nov 19, 2023
02581e0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 23, 2023
29c2901
Added round 1: Okx types and converts update.
samuael Nov 23, 2023
af5a97b
Update endpoints handling and types update
samuael Nov 25, 2023
3112408
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 25, 2023
9d19df1
Removed constants, updated unit tests, and updated endpoint methods
samuael Nov 26, 2023
8cbcca1
Slight endpoint and unit test update
samuael Nov 26, 2023
716c294
Added spread and other websocket endpoints and update
samuael Nov 29, 2023
a8e6f43
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 29, 2023
770b878
completed Spread WS Orderbook handler
samuael Nov 29, 2023
32a0bce
Added missing spread channels and handlers
samuael Nov 30, 2023
1a7f33c
Adding Bussinss websocket and missing subscriptions, update unit test…
samuael Dec 3, 2023
fe3c28e
Added spread endpoints to wrapper and unit tests update
samuael Dec 4, 2023
6a6cd71
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 4, 2023
42a9826
Added missing websocket subscriptions and copy trading endpoints
samuael Dec 9, 2023
b20386c
Added missing endpoints and re-organize business websocket handlers
samuael Dec 10, 2023
ddb379d
Docs update
samuael Dec 10, 2023
0bf59bc
Endpoints code updates
samuael Dec 11, 2023
7360c8e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 11, 2023
6c60fde
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 17, 2023
ab5ff5e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 22, 2023
b472922
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 31, 2023
7579c09
types, unit test and endpoints update
samuael Jan 15, 2024
3c6524f
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 15, 2024
340f5a8
Minor unit tests update
samuael Jan 21, 2024
44ce688
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 21, 2024
2834e29
spelling fix
samuael Jan 21, 2024
d7143fa
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 24, 2024
3c82295
fix unit test issues
samuael Jan 30, 2024
6ab81da
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 30, 2024
bdddb53
Updating unit tests error handling
samuael Feb 5, 2024
b4de8e5
Updating unit tests error handling
samuael Feb 5, 2024
41174d1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 8, 2024
c6d4274
Unit tests assertion handling update
samuael Feb 15, 2024
70f57b8
Unit tests update
samuael Feb 15, 2024
b971949
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 15, 2024
1ef68e5
Resolve linter issues
samuael Feb 16, 2024
f383383
linter issues fix
samuael Feb 16, 2024
960c2b3
Orderbook unit test error fix
samuael Feb 16, 2024
314d5b4
Minor fixes
samuael Feb 19, 2024
9a36a29
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 21, 2024
a20435b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 28, 2024
03ad8e5
Change on test handling and types
samuael Feb 28, 2024
fdf7e4a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 21, 2024
b6b2e3e
Updating unit tests and cleanups
samuael May 23, 2024
ede9af8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 28, 2024
54f3a0a
Fix unit test issues
samuael May 29, 2024
8106d20
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 29, 2024
efa96e8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 10, 2024
4b4c518
Add ratelimit test and update unit tests and methods
samuael Jun 11, 2024
c647b48
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 22, 2024
40d97d0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 12, 2024
e7c2b7c
Update method parameters and error declarations
samuael Jul 12, 2024
213888f
Added lending endpoints, unit tests, and update endpoint methods and …
samuael Jul 13, 2024
719f310
Update ratelimiters, add missing lending and trading endpoints and un…
samuael Jul 15, 2024
804b839
Update websocket authentication and subscription handling
samuael Jul 17, 2024
58685b5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 6, 2024
0c2265d
Minor update to unit test and types
samuael Sep 6, 2024
cfc8519
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 24, 2024
fb7fa19
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 17, 2024
9a9711b
Types, error handling, and other minor updates
samuael Oct 17, 2024
d6dbee7
Update unit tests and endpoint functions
samuael Oct 19, 2024
7c07649
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 19, 2024
d388a4b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 25, 2024
980d30a
error declarations update and unit tests
samuael Oct 25, 2024
b8c5264
Overall update on unit endpoint, unit tests, and types
samuael Oct 29, 2024
95dc4e0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 29, 2024
e406221
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 1, 2024
06300af
Adding review fixes
samuael Nov 1, 2024
82a77d0
Update on endpoints, order types, and unit tests
samuael Nov 2, 2024
6c08ec3
Update unit tests and endpoint functions
samuael Nov 3, 2024
439c460
Update on endpoint and update missing parameters
samuael Nov 4, 2024
9394e26
Implemented and tested newly added trading endpoints
samuael Nov 5, 2024
e877122
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 5, 2024
b77e1d8
endpoints update and unit tests
samuael Nov 6, 2024
0a55411
Update missing endpoints and update overall code
samuael Nov 7, 2024
14dd03a
added and testing funding and fiat related endpoints
samuael Nov 9, 2024
87c1a37
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 9, 2024
f003f9b
Update on convert and fiat related endpoints
samuael Nov 10, 2024
8985235
linter fix, types, endpoints, and unit tests update
samuael Nov 11, 2024
b3e7d71
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 11, 2024
736e267
linter issues fix
samuael Nov 11, 2024
30e576e
revert changes on tempos
samuael Nov 12, 2024
c00ce6d
Fix Panic and update websocket auth calls handling
samuael Nov 12, 2024
6266ad2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 12, 2024
5ffd43f
config linter issue fix
samuael Nov 12, 2024
c16906d
Fix panic issues and update unit tests
samuael Nov 13, 2024
ef765f4
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 13, 2024
f5e0728
Fix race condition, TestAllExchangeWrappers unit test issues
samuael Nov 14, 2024
43624d7
Fix withdrawal manager test issue
samuael Nov 17, 2024
f6220a4
Rename ClosePositionForContractrID --> ClosePositionForContractID
samuael Nov 17, 2024
f75c7e5
Rename ClosePositionForContractrID --> ClosePositionForContractID
samuael Nov 17, 2024
d7a6065
Fix error
samuael Nov 17, 2024
5d1e0d7
endpoints update and fix unit test issues
samuael Nov 18, 2024
2e4e1a1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 18, 2024
735728c
Merge branch 'okx_update' of https://github.com/samuael/gocryptotrade…
samuael Nov 18, 2024
567c9c3
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 20, 2024
f89574c
added unit tests, updated comments, and code sections
samuael Nov 21, 2024
36792ea
revert change in defaultSubscriptions
samuael Nov 21, 2024
c27d51b
few types comments update
samuael Nov 21, 2024
5a9edd5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 25, 2024
90479fe
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 28, 2024
22fdf03
Minor changes
samuael Nov 28, 2024
9bd5e7e
remove lending endpoints
samuael Dec 3, 2024
d485dcb
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 3, 2024
b52b6d7
rm mistakenly added code
samuael Dec 3, 2024
5406298
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 5, 2024
53fe0c7
fix unit test
samuael Dec 5, 2024
084753b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 7, 2024
cf31fb5
minor unit test fix
samuael Dec 9, 2024
1429501
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 9, 2024
62fac9c
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 12, 2024
d884ecb
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 16, 2024
121b6a0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 17, 2024
18badd9
Adding offline error tests, update endpoints function, config update
samuael Dec 17, 2024
076719b
Update unit test coverage for offline error handliing
samuael Dec 18, 2024
7c1cb10
Updating wrapper algo order coverage, endpoint calls, and unit tests
samuael Dec 19, 2024
0291113
Updating wrapper trade functions to accomodate algo orders
samuael Dec 20, 2024
cdddf2e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 21, 2024
53e09ce
update wrapper unit tests
samuael Dec 21, 2024
2df3ee7
Fix wrapper order functions offline errors handling
samuael Dec 22, 2024
d2ccc2d
Tested and updated wrapper order functions
samuael Dec 23, 2024
131126f
Address review comments
samuael Dec 23, 2024
54ac698
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 26, 2024
a5ebd9f
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 1, 2025
7822c9f
update order unit tests, and okx endpoint functions
samuael Jan 4, 2025
8bf71ac
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 4, 2025
6dd557e
finalize affected order, endpoint, and margin endpoints
samuael Jan 5, 2025
0dde48a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 8, 2025
b1b120d
Slight change on margin unit test
samuael Jan 9, 2025
39006e5
fix margin unit test issues
samuael Jan 9, 2025
7551b58
Minor change on unit test
samuael Jan 10, 2025
7bf2273
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 10, 2025
e4a2f35
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 13, 2025
7527375
updates on contract settlement and future contract wrapper function
samuael Jan 13, 2025
86b6a9c
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 14, 2025
087b420
add test coverage for contract functions and minor fix on wrapper
samuael Jan 14, 2025
8b36c4b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 20, 2025
fe6ef5e
Overall update and unit testing
samuael Jan 22, 2025
0a4b400
codespell, unit tests, type declaration and naming, and code-structur…
samuael Jan 23, 2025
38e7566
margin types value and validation function fix
samuael Jan 23, 2025
91dd78e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 24, 2025
4a0ce09
Update tests and helper funcs
samuael Jan 25, 2025
9cb7a76
Improve test coverage
samuael Jan 25, 2025
ca03367
helper functions and unit tests update
samuael Jan 25, 2025
4b2f00c
Fix margin unit test
samuael Jan 26, 2025
4e97b06
Minor review updates
samuael Jan 28, 2025
340aa80
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 28, 2025
8864f57
minor fix on if statement
samuael Jan 29, 2025
64936a8
Update helper functions
samuael Jan 30, 2025
2fc191f
error handling and functions naming update
samuael Jan 30, 2025
43955ad
update comment
samuael Jan 30, 2025
4258a29
minor error return fixes
samuael Jan 31, 2025
b74b459
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var (
ErrCannotCalculateOffline = errors.New("cannot calculate offline, unsupported")
ErrNoResponse = errors.New("no response")
ErrTypeAssertFailure = errors.New("type assert failure")
ErrNoResults = errors.New("no results found")
ErrUnknownError = errors.New("unknown error")
ErrGettingField = errors.New("error getting field")
ErrSettingField = errors.New("error setting field")
Expand Down
8 changes: 7 additions & 1 deletion config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,8 @@
"margin",
"option",
"perpetualswap",
"spot"
"spot",
"spread"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a config version to add spread to assetTypes for user's config:)
If this is the next PR to be merged, then it can be the next V* on master.
@thrasher- can confirm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what you mean by for user's config. If it is in the config.json files it is already done.

Correct me if I understood what you mean wrong

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is indeed targeted to be merged as soon as it's ready 🚀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuael I don't see that it's already done.
If I check out your branch, and run it spread is not added to the assets listed in pairs.
I thought I might be wrong and your call to SetGlobalPairsManager in SetDefaults might add it.
I'm thinking you want something like this which adds an entry for spread on upgrade.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbjk I am getting it and I deleted the reference from config just to make sure:

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this
I put a hardcoded symbol in because without it the first run won't go smoothly. Can't see a way around that for this kind of asset. If they were all dated then ... Really don't know how we'd make it safe for first run.
ensureOneEnabled thing would need to have new available pairs first.

Copy link
Collaborator

@gbjk gbjk Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so:

  • You have to have autoUpdatePairs enabled to get spread added using standard logic without a config version upgrade
  • With that, you'll get this after first run:
     "spread": {
      "assetEnabled": null,
      "enabled": "",

Which is kinda okay, cos the asset isn't enabled.
Think it'd probably interact okay with #1735 as well.

  • After the second run, enabled will be populated, and assetEnabled set to true, and everything is okay

This gives us a weird inconsistency on upgrade.
I'd vote for having a config upgrade to give us a sane available pairs base-state.
Also can choose if you want to enable or disable the asset by default. I'm assuming enable.

Also accepting if we just ignore this, but it feels unnecessarily harsh on upgraders to have different results on subsequent runs.

Also sparing a thought for users who run -dry in containers

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: No input from anyone else on this.

I think it's still actionable, and I provided an example solution above :)

],
"pairs": {
"futures": {
Expand All @@ -2162,6 +2163,11 @@
"assetEnabled": true,
"enabled": "BTC-USDT,ETH-USDT,OKB-USDT",
"available": "OKT-USDT,LTC-USDT,DOT-USDT,DOGE-USDT,LUNC-USDT,ETHW-USDT,LUNA-USDT,FIL-USDT,XRP-USDT,CITY-USDT,MENGO-USDT,ARG-USDT,POR-USDT,1INCH-USDT,AAVE-USDT,ABT-USDT,ACA-USDT,ADA-USDT,AERGO-USDT,AGLD-USDT,XMR-ETH,YFI-ETH,ZEC-ETH,LTC-OKB,XRP-OKB,ETC-OKB,BTC-USDT,ETH-USDT,OKB-USDT,OKT-USDT,LTC-USDT,DOT-USDT,DOGE-USDT,LUNC-USDT,ETHW-USDT,LUNA-USDT,FIL-USDT,XRP-USDT,CITY-USDT,MENGO-USDT,ARG-USDT,POR-USDT,1INCH-USDT,AAVE-USDT,ABT-USDT,ACA-USDT,ADA-USDT,AERGO-USDT,AGLD-USDT,AKITA-USDT,ALCX-USDT,ALGO-USDT,ALPHA-USDT,ANC-USDT,ANT-USDT,ANW-USDT,APE-USDT,APIX-USDT,API3-USDT,APM-USDT,AR-USDT,ARK-USDT,AST-USDT,ASTR-USDT,ATOM-USDT,AUCTION-USDT,AVAX-USDT,AXS-USDT,AZY-USDT,BABYDOGE-USDT,BADGER-USDT,BAL-USDT,BAND-USDT,BAT-USDT,BCD-USDT,BCH-USDT,BETH-USDT,BHP-USDT,BICO-USDT,BLOK-USDT,BNT-USDT,BORING-USDT,BORA-USDT,BRWL-USDT,BSV-USDT,BTG-USDT,BTM-USDT,BTT-USDT,BZZ-USDT,CELO-USDT,CEL-USDT,CELR-USDT,CELT-USDT,CFG-USDT,CFX-USDT,CGS-USDT,CHAT-USDT,CHE-USDT,CHZ-USDT,CLV-USDT,CMT-USDT,CNTM-USDT,COMP-USDT,CONV-USDT,COVER-USDT,CQT-USDT,CRO-USDT,CRV-USDT,CSPR-USDT,CTC-USDT,CTXC-USDT,CVC-USDT,CVP-USDT,CVT-USDT,CVX-USDT,DAI-USDT,DAO-USDT,DASH-USDT,DCR-USDT,DEP-USDT,DEVT-USDT,DGB-USDT,DHT-USDT,DIA-USDT,DMD-USDT,DNA-USDT,DOME-USDT,DORA-USDT,DOSE-USDT,DYDX-USDT,EC-USDT,EDEN-USDT,EFI-USDT,EGLD-USDT,EGT-USDT,ELF-USDT,ELON-USDT,ELT-USDT,EM-USDT,ENJ-USDT,ENS-USDT,EOS-USDT,ERN-USDT,ETC-USDT,EURT-USDT,FAIR-USDT,FAME-USDT,FITFI-USDT,FLM-USDT,FLOW-USDT,FODL-USDT,FORTH-USDT,FRONT-USDT,FSN-USDT,FTM-USDT,GALA-USDT,GALFT-USDT,GARI-USDT,GAS-USDT,GF-USDT,GHST-USDT,GLM-USDT,GLMR-USDT,GM-USDT,GMT-USDT,GODS-USDT,GOG-USDT,GRT-USDT,GTO-USDT,GUSD-USDT,HBAR-USDT,HC-USDT,HDAO-USDT,HEGIC-USDT,HYC-USDT,ICP-USDT,ICX-USDT,ILV-USDT,IMX-USDT,INT-USDT,INX-USDT,IOST-USDT,IOTA-USDT,IQ-USDT,JFI-USDT,JOE-USDT,JST-USDT,KAN-USDT,KAR-USDT,KCASH-USDT,KDA-USDT,KINE-USDT,KISHU-USDT,KLAY-USDT,KNC-USDT,KOL-USDT,KONO-USDT,KP3R-USDT,KSM-USDT,LAMB-USDT,LAT-USDT,LBA-USDT,LDN-USDT,LDO-USDT,LEASH-USDT,LEO-USDT,LET-USDT,LINK-USDT,LING-USDT,LITH-USDT,LON-USDT,LOON-USDT,LOOKS-USDT,LPT-USDT,LRC-USDT,LSK-USDT,MAGIC-USDT,MANA-USDT,MASK-USDT,MATIC-USDT,MCO-USDT,MDA-USDT,MDT-USDT,MEME-USDT,METIS-USDT,MILO-USDT,MINA-USDT,MIR-USDT,MITH-USDT,MKR-USDT,MLN-USDT,MOF-USDT,MON-USDT,MOVR-USDT,MOVEZ-USDT,MXC-USDT,MXT-USDT,NAS-USDT,NEAR-USDT,NEO-USDT,NFT-USDT,NMR-USDT,NULS-USDT,NYM-USDT,OM-USDT,OMG-USDT,OMI-USDT,ONE-USDT,ONT-USDT,OP-USDT,ORBS-USDT,ORB-USDT,ORS-USDT,OXT-USDT,PAY-USDT,PCI-USDT,PEOPLE-USDT,PERP-USDT,PHA-USDT,PICKLE-USDT,PIT-USDT,PLG-USDT,PNK-USDT,POLS-USDT,POLYDOGE-USDT,PPT-USDT,PRQ-USDT,PST-USDT,PSTAKE-USDT,QOM-USDT,QTUM-USDT,RACA-USDT,RAY-USDT,REN-USDT,REP-USDT,REVV-USDT,RFUEL-USDT,RIO-USDT,RNT-USDT,ROAD-USDT,RON-USDT,RSR-USDT,RSS3-USDT,RVN-USDT,SAITAMA-USDT,SAMO-USDT,SAND-USDT,SC-USDT,SD-USDT,SFG-USDT,SHIB-USDT,SIS-USDT,SKEB-USDT,SKL-USDT,SLP-USDT,SNT-USDT,SNX-USDT,SOC-USDT,SOL-USDT,SOS-USDT,SPELL-USDT,SRM-USDT,STARL-USDT,STC-USDT,STORJ-USDT,STRK-USDT,STX-USDT,SUN-USDT,SUSHI-USDT,SWEAT-USDT,SWFTC-USDT,SWRV-USDT,T-USDT,TAI-USDT,TAKI-USDT,TCT-USDT,THETA-USDT,THG-USDT,TON-USDT,TOPC-USDT,TORN-USDT,TOWN-USDT,TRADE-USDT,TRA-USDT,TRB-USDT,TRUE-USDT,TRX-USDT,TUP-USDT,TUSD-USDT,UMA-USDT,UMEE-USDT,UNI-USDT,USDC-USDT,USDP-USDT,USTC-USDT,UTK-USDT,VALUE-USDT,VELO-USDT,VRA-USDT,VSYS-USDT,WAVES-USDT,WAXP-USDT,WBTC-USDT,WEMIX-USDT,WGRT-USDT,WING-USDT,WIN-USDT,WNCG-USDT,WNXM-USDT,WOO-USDT,WSB-USDT,WXT-USDT,XAUT-USDT,XCH-USDT,XEC-USDT,XEM-USDT,XETA-USDT,XLM-USDT,XMR-USDT,XNO-USDT,XPR-USDT,XTZ-USDT,YEE-USDT,YFI-USDT,YFII-USDT,YGG-USDT,YOU-USDT,YOYO-USDT,ZBC-USDT,ZEC-USDT,ZEN-USDT,ZIL-USDT,ZKS-USDT,ZRX-USDT,ZYRO-USDT,BTC-USDC,ETH-USDC,ETH-BTC,OKB-USDC,OKT-USDC,LTC-USDC,DOT-USDC,DOGE-USDC,LUNC-USDC,ETHW-USDC,LUNA-USDC,FIL-USDC,XRP-USDC,1INCH-USDC,AAVE-USDC,ADA-USDC,AGLD-USDC,ALGO-USDC,ANC-USDC,ANT-USDC,APE-USDC,API3-USDC,AR-USDC,ASTR-USDC,ATOM-USDC,AVAX-USDC,AXS-USDC,AZY-USDC,BABYDOGE-USDC,BAT-USDC,BCH-USDC,BICO-USDC,BSV-USDC,CEL-USDC,CELO-USDC,CELT-USDC,CHZ-USDC,COMP-USDC,CRO-USDC,CRV-USDC,CSPR-USDC,DASH-USDC,DEP-USDC,DOME-USDC,DYDX-USDC,EGLD-USDC,ELT-USDC,ENS-USDC,EOS-USDC,ETC-USDC,FITFI-USDC,FLM-USDC,FLOW-USDC,FTM-USDC,GALA-USDC,GALFT-USDC,GARI-USDC,GLMR-USDC,GMT-USDC,GODS-USDC,GRT-USDC,HBAR-USDC,ICP-USDC,IMX-USDC,IOST-USDC,JST-USDC,KISHU-USDC,KLAY-USDC,KNC-USDC,KSM-USDC,LINK-USDC,LOOKS-USDC,LRC-USDC,MANA-USDC,MASK-USDC,MATIC-USDC,MINA-USDC,MKR-USDC,MOF-USDC,MOVEZ-USDC,MXC-USDC,NEAR-USDC,NFT-USDC,NMR-USDC,NYM-USDC,OMG-USDC,OP-USDC,PEOPLE-USDC,PERP-USDC,RACA-USDC,RSR-USDC,SAITAMA-USDC,SAND-USDC,SHIB-USDC,SLP-USDC,SNX-USDC,SOC-USDC,SOL-USDC,SOS-USDC,SRM-USDC,STARL-USDC,STC-USDC,STORJ-USDC,STX-USDC,SUSHI-USDC,SWFTC-USDC,THETA-USDC,TON-USDC,TORN-USDC,TRB-USDC,TRX-USDC,UNI-USDC,USDP-USDC,USTC-USDC,VRA-USDC,WAVES-USDC,XCH-USDC,XEM-USDC,XLM-USDC,XMR-USDC,XNO-USDC,XTZ-USDC,YFI-USDC,YFII-USDC,YGG-USDC,ZEC-USDC,ZIL-USDC,BTC-DAI,ETH-DAI,BTC-USDK,ETH-USDK,USDT-USDK,OKB-BTC,OKT-BTC,LTC-BTC,DOT-BTC,DOGE-BTC,FIL-BTC,XRP-BTC,AAVE-BTC,ADA-BTC,ALGO-BTC,ALPHA-BTC,ANT-BTC,ATOM-BTC,AVAX-BTC,BADGER-BTC,BAT-BTC,BCD-BTC,BCH-BTC,BNT-BTC,BSV-BTC,BTG-BTC,BTM-BTC,CELO-BTC,CELT-BTC,CHZ-BTC,COMP-BTC,CQT-BTC,CRO-BTC,CRV-BTC,CTC-BTC,CVC-BTC,DASH-BTC,DCR-BTC,DGB-BTC,EGLD-BTC,ELF-BTC,ENJ-BTC,EOS-BTC,ETC-BTC,FLOW-BTC,GAS-BTC,GRT-BTC,GTO-BTC,HBAR-BTC,HC-BTC,ICP-BTC,ICX-BTC,INT-BTC,IOST-BTC,IOTA-BTC,KLAY-BTC,KNC-BTC,KSM-BTC,LINK-BTC,LRC-BTC,LSK-BTC,MANA-BTC,MITH-BTC,MKR-BTC,NAS-BTC,NEAR-BTC,NEO-BTC,NULS-BTC,OMG-BTC,ONT-BTC,PST-BTC,QTUM-BTC,REN-BTC,RSR-BTC,RVN-BTC,SC-BTC,SNT-BTC,SOL-BTC,SRM-BTC,STX-BTC,SWFTC-BTC,THETA-BTC,TRUE-BTC,TRX-BTC,UNI-BTC,VSYS-BTC,WAVES-BTC,WBTC-BTC,WXT-BTC,XCH-BTC,XEM-BTC,XLM-BTC,XMR-BTC,XTZ-BTC,YFI-BTC,YOU-BTC,ZEC-BTC,ZEN-BTC,ZIL-BTC,ZRX-BTC,OKB-ETH,OKT-ETH,LTC-ETH,DOT-ETH,DOGE-ETH,FIL-ETH,XRP-ETH,AAVE-ETH,ADA-ETH,API3-ETH,ATOM-ETH,AVAX-ETH,BETH-ETH,CRV-ETH,DASH-ETH,EOS-ETH,ETC-ETH,FLOW-ETH,GAS-ETH,GHST-ETH,HEGIC-ETH,INT-ETH,IOST-ETH,KSM-ETH,LINK-ETH,MANA-ETH,MKR-ETH,NEAR-ETH,NEO-ETH,NULS-ETH,OM-ETH,QTUM-ETH,SNX-ETH,SOL-ETH,SUSHI-ETH,SWFTC-ETH,TRX-ETH,UNI-ETH,WBTC-ETH,XLM-ETH,XMR-ETH,YFI-ETH,ZEC-ETH,LTC-OKB,XRP-OKB,ETC-OKB,OKDOT1-DOT,OKDOT2-DOT,BTC-EURT,ETH-EURT"
},
"spread": {
"assetEnabled": true,
"enabled": "BTC-USDT-SWAP_BTC-USDT-250328,ETH-USDT-SWAP_ETH-USD-SWAP,ETH-USDT_ETH-USD-250627",
"available": "BTC-USDT-SWAP_BTC-USDT-250328,ETH-USDT-SWAP_ETH-USD-SWAP,ETH-USDT_ETH-USD-250627,BTC-USD-241220_BTC-USD-250328,BTC-USDT-SWAP_BTC-USDT-250228,BTC-USDT_BTC-USDT-250131,BTC-USD-SWAP_BTC-USD-250328,BTC-USDT-241220_BTC-USDT-250627,ETH-USDT-241220_ETH-USDT-250328,BTC-USD-250228_BTC-USD-250627,ETH-USDT-SWAP_ETH-USDT-250328,BTC-USD-241220_BTC-USD-250228,ETH-USDT-250328_ETH-USDT-250627,DOGE-USDT_DOGE-USDT-SWAP,ETH-USD-SWAP_ETH-USD-241227,BTC-USDT_BTC-USD-241227,BTC-USDT-SWAP_BTC-USDT-250131,ETH-USDT-241220_ETH-USDT-250627,ETH-USD-SWAP_ETH-USD-241220,BTC-USD-SWAP_BTC-USD-250228,ETH-USD-241227_ETH-USD-250228,BTC-USDT_BTC-USDT-250328,LTC-USDT_LTC-USDT-SWAP,ETH-USDT_ETH-USD-250328,ETH-USD-250328_ETH-USD-250627,ETH-USD-241227_ETH-USD-250328,BTC-USD-SWAP_BTC-USD-250131,BTC-USDT_BTC-USDT-250228,ETH-USD-250228_ETH-USD-250328,SOL-USDT_SOL-USDT-SWAP,ETH-USDT_ETH-USD-SWAP,BTC-USD-241220_BTC-USD-241227,ETH-USD-250131_ETH-USD-250328,ETH-USD-SWAP_ETH-USD-250131,BTC-USDT-241227_BTC-USDT-250131,ETH-USDT_ETH-USDT-250627,ETH-USDT-SWAP_ETH-USDT-250627,BTC-USDT_BTC-USDT-SWAP,BTC-USDT-SWAP_BTC-USDT-250627,BTC-USDT_BTC-USD-SWAP,BTC-USDT-SWAP_BTC-USD-SWAP,ETH-USDT-241220_ETH-USDT-241227,ETH-USD-241220_ETH-USD-250131,ETH-USD-SWAP_ETH-USD-250228,ETH-USD-241227_ETH-USD-250131,BTC-USDT_BTC-USD-250627,BTC-USD-241220_BTC-USD-250131,ETH-USD-241220_ETH-USD-241227,BTC-USD-SWAP_BTC-USD-250627,BTC-USD-241227_BTC-USD-250131,ETH-USD-SWAP_ETH-USD-250328,ETH-USD-250228_ETH-USD-250627,BTC-USDT-241227_BTC-USDT-250228,BTC-USDT_BTC-USD-250328,ETH-USD-250131_ETH-USD-250627,BTC-USDT_BTC-USDT-250627,BTC-USDT-241227_BTC-USDT-250328,BTC-USD-241227_BTC-USD-250328,BTC-USDT-250131_BTC-USDT-250328,BCH-USDT_BCH-USDT-SWAP,BTC-USDT-250228_BTC-USDT-250328,BTC-USD-250328_BTC-USD-250627,BTC-USDT-241220_BTC-USDT-241227,BTC-USD-241227_BTC-USD-250228,ETH-USDT_ETH-USDT-250328,BTC-USDT-250131_BTC-USDT-250228,BTC-USD-250131_BTC-USD-250627,ETH-USD-SWAP_ETH-USD-250627,ETH-USD-241220_ETH-USD-250228,BTC-USD-SWAP_BTC-USD-241227,BTC-USD-SWAP_BTC-USD-241220,BTC-USD-250131_BTC-USD-250328,BTC-USDT-241227_BTC-USDT-250627,ETH-USD-250131_ETH-USD-250228,ETH-USD-241220_ETH-USD-250328,ETH-USDT_ETH-USDT-241227,ETH-USDT-SWAP_ETH-USDT-241220,BTC-USDT-241220_BTC-USDT-250328,BTC-USD-250228_BTC-USD-250328,ETH-USDT-SWAP_ETH-USDT-241227,BTC-USDT-SWAP_BTC-USDT-241220,ETH-USDT_ETH-USDT-241220,ETH-USDT-241227_ETH-USDT-250627,BTC-USD-241227_BTC-USD-250627,BTC-USDT-241220_BTC-USDT-250228,BTC-USDT-250131_BTC-USDT-250627,BTC-USD-241220_BTC-USD-250627,BTC-USDT-SWAP_BTC-USDT-241227,BTC-USD-250131_BTC-USD-250228,BTC-USDT-250328_BTC-USDT-250627,ETH-USD-241220_ETH-USD-250627,XRP-USDT_XRP-USDT-SWAP,ETH-USD-241227_ETH-USD-250627,BTC-USDT_BTC-USDT-241227,BTC-USDT-250228_BTC-USDT-250627,BTC-USDT_BTC-USDT-241220,ETH-USDT_ETH-USD-241227,BTC-USDT-241220_BTC-USDT-250131,ETH-USDT_ETH-USDT-SWAP,ETH-USDT-241227_ETH-USDT-25032"
}
}
},
Expand Down
9 changes: 2 additions & 7 deletions database/repository/withdraw/withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package withdraw
import (
"context"
"database/sql"
"errors"
"time"

"github.com/gofrs/uuid"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/database"
modelPSQL "github.com/thrasher-corp/gocryptotrader/database/models/postgres"
Expand All @@ -19,11 +19,6 @@ import (
"github.com/thrasher-corp/sqlboiler/queries/qm"
)

var (
// ErrNoResults is the error returned if no results are found
ErrNoResults = errors.New("no results found")
)

// Event stores Withdrawal Response details in database
func Event(res *withdraw.Response) {
if database.DB.SQL == nil {
Expand Down Expand Up @@ -424,7 +419,7 @@ func getByColumns(q []qm.QueryMod) ([]*withdraw.Response, error) {
}
}
if len(resp) == 0 {
return nil, ErrNoResults
return nil, common.ErrNoResults
}
return resp, nil
}
5 changes: 3 additions & 2 deletions database/repository/withdraw/withdraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"
"time"

"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/database"
"github.com/thrasher-corp/gocryptotrader/database/drivers"
Expand Down Expand Up @@ -159,7 +160,7 @@ func withdrawHelper(t *testing.T) {

_, err := GetEventByUUID(withdraw.DryRunID.String())
if err != nil {
if !errors.Is(err, ErrNoResults) {
if !errors.Is(err, common.ErrNoResults) {
t.Fatal(err)
}
}
Expand All @@ -181,7 +182,7 @@ func withdrawHelper(t *testing.T) {
if len(v) > 0 {
_, err = GetEventByUUID(v[0].ID.String())
if err != nil {
if !errors.Is(err, ErrNoResults) {
if !errors.Is(err, common.ErrNoResults) {
t.Error(err)
}
}
Expand Down
8 changes: 7 additions & 1 deletion exchanges/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
USDCMarginedFutures
FutureCombo
LinearContract
Spread
// Options asset consts must come below this comment for method `IsOptions`
Options
OptionCombo
Expand All @@ -58,6 +59,7 @@ const (
perpetualContract = "perpetualcontract"
perpetualSwap = "perpetualswap"
swap = "swap"
spread = "spread"
futures = "futures"
deliveryFutures = "delivery"
upsideProfitContract = "upsideprofitcontract"
Expand All @@ -73,7 +75,7 @@ const (
)

var (
supportedList = Items{Spot, Margin, CrossMargin, MarginFunding, Index, Binary, PerpetualContract, PerpetualSwap, Futures, DeliveryFutures, UpsideProfitContract, DownsideProfitContract, CoinMarginedFutures, USDTMarginedFutures, USDCMarginedFutures, Options, LinearContract, OptionCombo, FutureCombo}
supportedList = Items{Spot, Margin, CrossMargin, MarginFunding, Index, Binary, PerpetualContract, PerpetualSwap, Futures, DeliveryFutures, UpsideProfitContract, DownsideProfitContract, CoinMarginedFutures, USDTMarginedFutures, USDCMarginedFutures, Options, LinearContract, OptionCombo, FutureCombo, Spread}
)

// Supported returns a list of supported asset types
Expand All @@ -100,6 +102,8 @@ func (a Item) String() string {
return perpetualContract
case PerpetualSwap:
return perpetualSwap
case Spread:
return spread
case Futures:
return futures
case DeliveryFutures:
Expand Down Expand Up @@ -220,6 +224,8 @@ func New(input string) (Item, error) {
return PerpetualContract, nil
case perpetualSwap, swap:
return PerpetualSwap, nil
case spread:
return Spread, nil
case futures:
return Futures, nil
case upsideProfitContract:
Expand Down
3 changes: 2 additions & 1 deletion exchanges/asset/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestIsValid(t *testing.T) {

func TestIsFutures(t *testing.T) {
t.Parallel()
valid := []Item{PerpetualContract, PerpetualSwap, Futures, DeliveryFutures, UpsideProfitContract, DownsideProfitContract, CoinMarginedFutures, USDTMarginedFutures, USDCMarginedFutures, FutureCombo, LinearContract}
valid := []Item{PerpetualContract, PerpetualSwap, Futures, DeliveryFutures, UpsideProfitContract, DownsideProfitContract, CoinMarginedFutures, USDTMarginedFutures, USDCMarginedFutures, FutureCombo, LinearContract, Spread}
for a := range All {
if slices.Contains(valid, a) {
require.Truef(t, a.IsFutures(), "IsFutures must return true for %s", a)
Expand Down Expand Up @@ -117,6 +117,7 @@ func TestNew(t *testing.T) {
{Input: "Future", Error: ErrNotSupported},
{Input: "option_combo", Expected: OptionCombo},
{Input: "future_combo", Expected: FutureCombo},
{Input: "spread", Expected: Spread},
{Input: "linearContract", Expected: LinearContract},
}

Expand Down
2 changes: 2 additions & 0 deletions exchanges/collateral/collateral.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (t Mode) String() string {
return multiCollateralStr
case PortfolioMode:
return portfolioCollateralStr
case SpotFuturesMode:
return spotFuturesCollateralStr
case UnknownMode:
return unknownCollateralStr
}
Expand Down
3 changes: 3 additions & 0 deletions exchanges/collateral/collateral_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ func TestValidCollateralType(t *testing.T) {
if !PortfolioMode.Valid() {
t.Fatal("expected 'true', received 'false'")
}
if !SpotFuturesMode.Valid() {
t.Fatal("expected 'true', received 'false'")
}
if UnsetMode.Valid() {
t.Fatal("expected 'false', received 'true'")
}
Expand Down
15 changes: 9 additions & 6 deletions exchanges/collateral/collateral_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@ const (
PortfolioMode
// UnknownMode has collateral allocated in an unknown manner at present, but is not unset
UnknownMode
// SpotFuturesMode has collateral allocated across spot and futures accounts
SpotFuturesMode
)

const (
unsetCollateralStr = "unset"
singleCollateralStr = "single"
multiCollateralStr = "multi"
portfolioCollateralStr = "portfolio"
unknownCollateralStr = "unknown"
unsetCollateralStr = "unset"
singleCollateralStr = "single"
multiCollateralStr = "multi"
portfolioCollateralStr = "portfolio"
spotFuturesCollateralStr = "spot_futures"
unknownCollateralStr = "unknown"
)

// ErrInvalidCollateralMode is returned when converting invalid string to collateral mode
var ErrInvalidCollateralMode = errors.New("invalid collateral mode")

var supportedCollateralModes = SingleMode | MultiMode | PortfolioMode
var supportedCollateralModes = SingleMode | MultiMode | PortfolioMode | SpotFuturesMode
gbjk marked this conversation as resolved.
Show resolved Hide resolved

// ByPosition shows how much collateral is used
// from positions
Expand Down
31 changes: 31 additions & 0 deletions exchanges/futures/contract.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package futures

import (
"errors"
"strings"
"time"

"github.com/shopspring/decimal"
Expand All @@ -9,6 +11,11 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/fundingrate"
)

// var error definitions
var (
ErrInvalidContractSettlementType = errors.New("invalid contract settlement type")
)

// Contract holds details on futures contracts
type Contract struct {
Exchange string
Expand Down Expand Up @@ -41,6 +48,7 @@ const (
Inverse
Quanto
LinearOrInverse
Hybrid
)

// String returns the string representation of a contract settlement type
Expand All @@ -56,11 +64,34 @@ func (d ContractSettlementType) String() string {
return "quanto"
case LinearOrInverse:
return "linearOrInverse"
case Hybrid:
return "hybrid"
default:
return "unknown"
}
}

// StringToContractSettlementType for converting case insensitive contract settlement type
func StringToContractSettlementType(cstype string) (ContractSettlementType, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are here can you please expand coverage across this file please 🙏

cstype = strings.ToLower(cstype)
switch cstype {
case UnsetSettlementType.String(), "":
return UnsetSettlementType, nil
case Linear.String():
return Linear, nil
case Inverse.String():
return Inverse, nil
case Quanto.String():
return Quanto, nil
case "linearorinverse":
return LinearOrInverse, nil
case Hybrid.String():
return Hybrid, nil
default:
return UnsetSettlementType, ErrInvalidContractSettlementType
}
}

// ContractType holds the various style of contracts offered by futures exchanges
type ContractType uint8

Expand Down
71 changes: 71 additions & 0 deletions exchanges/futures/contract_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package futures

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestStringToContractSettlementType(t *testing.T) {
t.Parallel()
contractSettlementTypesMap := map[string]struct {
CT ContractSettlementType
Error error
}{
"lInear": {Linear, nil},
"LINEAR": {Linear, nil},
"Inverse": {Inverse, nil},
"unset": {UnsetSettlementType, nil},
"hybRiD": {Hybrid, nil},
"LinearOrInverse": {LinearOrInverse, nil},
"": {UnsetSettlementType, nil},
"Quanto": {Quanto, nil},
"QUANTO": {Quanto, nil},
"Unknown": {UnsetSettlementType, ErrInvalidContractSettlementType},
}
for x, v := range contractSettlementTypesMap {
val, err := StringToContractSettlementType(x)
assert.Equal(t, v.CT, val)
assert.ErrorIs(t, err, v.Error)
}
}

func TestContractSettlementTypeString(t *testing.T) {
t.Parallel()
contractSettlementTypeToStringMap := map[ContractSettlementType]string{
UnsetSettlementType: "unset",
Linear: "linear",
Inverse: "inverse",
Quanto: "quanto",
LinearOrInverse: "linearOrInverse",
Hybrid: "hybrid",
ContractSettlementType(200): "unknown",
}
for k, v := range contractSettlementTypeToStringMap {
assert.Equal(t, v, k.String())
}
}

func TestContractTypeToString(t *testing.T) {
t.Parallel()
contractTypeToStringMap := map[ContractType]string{
Daily: "day",
Perpetual: "perpetual",
LongDated: "long_dated",
Weekly: "weekly",
Fortnightly: "fortnightly",
ThreeWeekly: "three-weekly",
Monthly: "monthly",
Quarterly: "quarterly",
SemiAnnually: "semi-annually",
HalfYearly: "half-yearly",
NineMonthly: "nine-monthly",
Yearly: "yearly",
Unknown: "unknown",
UnsetContractType: "unset",
ContractType(200): "unset",
}
for k, v := range contractTypeToStringMap {
assert.Equal(t, v, k.String())
}
}
2 changes: 1 addition & 1 deletion exchanges/gateio/gateio_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
currency.GAS: 0.69,
currency.TORN: 0.95,
currency.DNT: 920,
currency.ANC: 44,

Check failure on line 315 in exchanges/gateio/gateio_types.go

View workflow job for this annotation

GitHub Actions / Spell checker

ANC ==> AND
currency.MLN: 0.18,
currency.KAR: 3.4,
currency.FARM: 0.41,
Expand Down Expand Up @@ -1301,7 +1301,7 @@
BorrowedNet string `json:"borrowed_net"`
TotalNetAssetInUSDT string `json:"net"`
PositionLeverage string `json:"leverage"`
Risk string `json:"risk"` // Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: total / (borrowed+interest)
Risk string `json:"risk"` // Risk percentage; Liquidation is triggered when this falls below required margin. Calculation: total / (borrowed+interest)
}

// WalletSavedAddress represents currency saved address
Expand Down
Loading
Loading