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: Add V2 Crypto.com exchange support #1122

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
27bbb99
Creating exchange using exchange_template and adding public eps
samuael Jan 16, 2023
1a548f0
Adding private endpoints
samuael Jan 17, 2023
7b7feb1
Adding private endpoints and unit tests
samuael Jan 18, 2023
3d46675
Added SPOT API endpoints and unit tests
samuael Jan 19, 2023
689d22d
Added Sub-Account APIs
samuael Jan 19, 2023
0bb7a40
Merge branch 'master' into cryptoCom
samuael Jan 19, 2023
5c4d2b0
Adding rate limiter and OTC Trading APIs
samuael Jan 20, 2023
b1d44e1
Adding wrapper functions
samuael Jan 21, 2023
31b1c37
Adding wrapper functions
samuael Jan 21, 2023
c2da8ba
Adding authenticated wrapper functions
samuael Jan 21, 2023
6d875d1
Adding werbsocket functions
samuael Jan 24, 2023
46df860
adding websocket connection subscription handling
samuael Jan 25, 2023
6bafbf9
Adding websocket push data handlers
samuael Jan 26, 2023
273d22f
fix on websocket connection, authentication, and completed websocket …
samuael Jan 28, 2023
25f5219
fix linter issues[
samuael Jan 28, 2023
62b0841
Merge branch 'master' into cryptoCom
samuael Jan 28, 2023
d76745a
Slight updates on the documentations
samuael Jan 28, 2023
d0721dd
Minor unit tests update
samuael Jan 29, 2023
b2d948e
Address minor issues
samuael Jan 31, 2023
60dc1d7
inspection fix
samuael Jan 31, 2023
9b0e03a
Merge branch 'master' into cryptoCom
samuael Jan 31, 2023
2a6dc48
Minor update
samuael Feb 7, 2023
a57f7c5
minor fixes
samuael Feb 8, 2023
99f2274
Merge branch 'master' into cryptoCom
samuael Feb 9, 2023
18bbd1d
Minor fix
samuael Feb 9, 2023
de07b60
Remove WsConnect unit test to prevent race cond
samuael Feb 12, 2023
1e37072
Fix on unit tests
samuael Feb 14, 2023
48fa29d
Update rate limit and small formating issues
samuael Feb 20, 2023
0549510
WS fix
samuael Feb 20, 2023
75dc05b
Merge branch 'master' into cryptoCom
samuael Feb 27, 2023
490c117
Add GetFee wrapper func
samuael Feb 28, 2023
a149dd9
Adding wrapper function
samuael Mar 1, 2023
c7fff3c
Merge branch 'master' into cryptoCom
samuael Mar 8, 2023
626a46f
Minor update
samuael Mar 10, 2023
b0b307c
race, unit test, and websocket handling fix
samuael Mar 17, 2023
d434174
websocket handler fix
samuael Mar 17, 2023
136c4df
Minor websocekt rountine manager update
samuael Mar 20, 2023
4ae8d5c
Minor fix
samuael Mar 28, 2023
3cd3874
reverting deleted wrapper function
samuael Mar 28, 2023
ae8f9be
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 4, 2023
50024d9
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 5, 2023
e7171f3
slight documentation fix
samuael Apr 16, 2023
11ded83
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 16, 2023
ff63657
model and functions test update
samuael Apr 27, 2023
85b36f0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 27, 2023
e0ae743
Documentation and minor linter fix
samuael Apr 28, 2023
32ef0a2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 30, 2023
e07b043
fix type conversion method and add unit test
samuael May 31, 2023
a3f973c
timestamp unmarshal fix
samuael Jun 1, 2023
9dae023
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 8, 2023
f999d8e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 19, 2023
8bf25bd
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 20, 2023
a2b2669
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 22, 2023
a9f9986
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 26, 2023
30ccfa3
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 3, 2023
7204ad7
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 4, 2023
a640232
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 5, 2023
0ed85bd
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 6, 2023
9dd6396
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 12, 2023
a011dde
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 28, 2023
0bca653
small update on unit test and orderbook testing
samuael Sep 30, 2023
933898e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 4, 2023
1578af0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 10, 2023
710f12a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 5, 2023
1366934
add missing wrapper declaration
samuael Nov 5, 2023
c3e0c5d
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 16, 2023
035e850
Types, Wrapper functions, and unit tests updates
samuael Dec 16, 2023
9eddc9d
Minor unit test update
samuael Dec 16, 2023
79f5214
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 22, 2023
b9a3598
Types update
samuael Dec 22, 2023
39f7cf1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 28, 2023
f1ae01e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 31, 2023
98f3441
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 3, 2024
f5937da
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 8, 2024
c30e347
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 20, 2024
86fdbc8
Update unit test handlings
samuael Mar 20, 2024
b7e7e7c
Fit unix test, types, and linter issues
samuael Mar 23, 2024
d9f6b2a
Unit tests and few endpoints update
samuael Jun 5, 2024
d04c9ca
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 5, 2024
91614ce
Update ratelimiter, wrapper, and few changes
samuael Jun 5, 2024
a537c5a
Config lint fix
samuael Jun 5, 2024
0e16a7d
endpoints update and started adding missing endpoints, and unit tests
samuael Jun 5, 2024
f316c24
Added missing endpoints and unit tests
samuael Jun 6, 2024
890207d
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 22, 2024
ed8dad5
Minor cleanup on websocket configuration
samuael Jun 22, 2024
235c48c
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 6, 2024
12e1f13
replace errors and minor changes
samuael Jul 6, 2024
333d59e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 14, 2024
6bc8907
Update REST endpoints, types, and unit tests
samuael Oct 14, 2024
0b8eb99
Websocket endpoints error handling update
samuael Oct 15, 2024
9d138e8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 15, 2024
6f00725
Added Staking endpoint and unit testing
samuael Oct 22, 2024
c8c640f
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 22, 2024
7d71b49
Added missing updates
samuael Oct 23, 2024
6366cb8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 24, 2024
e66e793
Update websocket endpoints, types, and unit tests
samuael Oct 24, 2024
f9bb92a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 25, 2024
3ea7789
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 1, 2024
4a64dfe
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 14, 2024
238a281
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 20, 2024
b822d76
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 28, 2024
55d8088
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 7, 2024
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
6 changes: 3 additions & 3 deletions config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -1377,9 +1377,9 @@
"enabled": {
"autoPairUpdates": true,
"websocketAPI": true,
"saveTradeData": false,
"tradeFeed": false,
"fillsFeed": false
"saveTradeData": true,
"tradeFeed": true,
"fillsFeed": true
}
},
"bankAccounts": [
Expand Down
181 changes: 49 additions & 132 deletions exchanges/cryptodotcom/cryptodotcom.go

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions exchanges/cryptodotcom/cryptodotcom_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,28 @@ func (d *cryptoDotComMilliSecString) UnmarshalJSON(data []byte) error {
func (d *cryptoDotComMilliSecString) Time() time.Time {
return time.UnixMilli(int64(*d))
}

type cryptoDotComNanoSecString int64

// UnmarshalJSON converts string embedded unix nano-second timestamp information into cryptoDotComNanoSecString instance.
func (a *cryptoDotComNanoSecString) UnmarshalJSON(data []byte) error {
var value string
err := json.Unmarshal(data, &value)
if err != nil {
return err
}
var nanoTimestamp int64
if value != "" {
nanoTimestamp, err = strconv.ParseInt(value, 10, 64)
if err != nil {
return err
}
}
*a = cryptoDotComNanoSecString(nanoTimestamp)
return nil
}

// Time returns a time.Time instance from unix nano second timestamp information
func (a *cryptoDotComNanoSecString) Time() time.Time {
return time.Unix(int64(*a)/1e9, int64(*a)%1e9)
}
2 changes: 0 additions & 2 deletions exchanges/cryptodotcom/cryptodotcom_ratelimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ func SetRateLimit() *RateLimiter {
PublicGetValuations: request.NewRateLimit(oneSecondInterval, hundredPerInterval),
PublicGetExpiredSettlementPrice: request.NewRateLimit(oneSecondInterval, hundredPerInterval),
PublicGetInsurance: request.NewRateLimit(oneSecondInterval, hundredPerInterval),
// PrivateSetCancelOnDisconnect: request.NewRateLimit(),
// PrivateGetCancelOnDisconnect: request.NewRateLimit(),
PrivateUserBalance: request.NewRateLimit(hundredMilliSecondsInterval, threePerInterval),
PrivateUserBalanceHistory: request.NewRateLimit(hundredMilliSecondsInterval, threePerInterval),
PrivateCreateSubAccountTransfer: request.NewRateLimit(hundredMilliSecondsInterval, threePerInterval),
Expand Down
26 changes: 22 additions & 4 deletions exchanges/cryptodotcom/cryptodotcom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ func TestGetPersonalOpenOrders(t *testing.T) {
if err != nil {
t.Error(err)
}
t.Error(err)
shazbert marked this conversation as resolved.
Show resolved Hide resolved
_, err = cr.WsRetrivePersonalOpenOrders("", 0, 0)
if err != nil {
t.Error(err)
Expand Down Expand Up @@ -391,7 +392,7 @@ func TestRequestOTCQuote(t *testing.T) {
if !areTestAPIKeysSet() {
t.Skip(credInfoNotProvided)
}
_, err := cr.RequestOTCQuote(context.Background(), currency.BTC, currency.USDT, .001, 232, "BUY")
_, err := cr.RequestOTCQuote(context.Background(), currency.NewPair(currency.BTC, currency.USDT), .001, 232, "BUY")
if err != nil {
t.Error(err)
}
Expand All @@ -413,7 +414,7 @@ func TestGetOTCQuoteHistory(t *testing.T) {
if !areTestAPIKeysSet() {
t.Skip(credInfoNotProvided)
}
_, err := cr.GetOTCQuoteHistory(context.Background(), currency.EMPTYCODE, currency.EMPTYCODE, time.Time{}, time.Time{}, 0, 10)
_, err := cr.GetOTCQuoteHistory(context.Background(), currency.NewPair(currency.EMPTYCODE, currency.EMPTYCODE), time.Time{}, time.Time{}, 0, 10)
shazbert marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
t.Error(err)
}
Expand All @@ -424,7 +425,7 @@ func TestGetOTCTradeHistory(t *testing.T) {
if !areTestAPIKeysSet() {
t.Skip(credInfoNotProvided)
}
_, err := cr.GetOTCTradeHistory(context.Background(), currency.BTC, currency.USDT, time.Time{}, time.Time{}, 0, 0)
_, err := cr.GetOTCTradeHistory(context.Background(), currency.NewPair(currency.BTC, currency.USDT), time.Time{}, time.Time{}, 0, 0)
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -546,7 +547,7 @@ func TestGetHistoricCandles(t *testing.T) {
if err != nil {
t.Fatal(err)
}
startTime := time.Now().Add(-time.Hour * 40)
startTime := time.Now().Add(-time.Minute * 40)
endTime := time.Now()
_, err = cr.GetHistoricCandles(context.Background(), enabledPairs[0], asset.Spot, kline.OneDay, startTime, endTime)
if err != nil {
Expand Down Expand Up @@ -620,6 +621,23 @@ func TestSubmitOrder(t *testing.T) {
if err != nil {
t.Error("Cryptodotcom SubmitOrder() error", err)
}
orderSubmission = &order.Submit{
Pair: currency.Pair{
Base: currency.LTC,
Quote: currency.BTC,
},
Exchange: cr.Name,
Side: order.Buy,
Type: order.Limit,
Price: 1,
Amount: 1000000000,
ClientID: "myOwnOrder",
AssetType: asset.Spot,
}
_, err = cr.SubmitOrder(context.Background(), orderSubmission)
if err != nil {
t.Error("Cryptodotcom SubmitOrder() error", err)
}
}
func TestCancelOrder(t *testing.T) {
t.Parallel()
Expand Down
Loading