Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
5412e91
Added TimeInForce type and updated related files
samuael Oct 29, 2023
0bbd6fb
Linter issue fix and minor coinbasepro type update
samuael Oct 29, 2023
b786e75
Bitrex consts update
samuael Oct 29, 2023
afa9695
added unit test and minor changes in bittrex
samuael Oct 30, 2023
cb2619b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 5, 2023
da4b3cb
Unit tests update
samuael Nov 15, 2023
e41ab86
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 15, 2023
c9b88ab
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 23, 2023
e11beef
Fix minor linter issues
samuael Nov 23, 2023
9add848
Update TestStringToTimeInForce unit test
samuael Nov 27, 2023
aecc942
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 27, 2023
3a7ac71
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 29, 2023
44f1cbb
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 6, 2023
964ed95
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 22, 2023
05b4921
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 27, 2023
2179454
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 31, 2023
3043702
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 2, 2024
45b3596
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 16, 2024
318152b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 24, 2024
cede5cb
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 29, 2024
3aa605a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 28, 2024
6dd27b9
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 6, 2024
c0ca501
Exchange test template change
cranktakular Mar 8, 2024
c09f439
A different approach
cranktakular Mar 11, 2024
6b3e010
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 13, 2024
d82cc0c
fix conflict with gateio timeInForce
samuael Mar 18, 2024
b453062
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 18, 2024
b115b2b
minor exchange template update
samuael Mar 26, 2024
e64ae62
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 26, 2024
917dd6b
Minor fix to test_files template
samuael Mar 26, 2024
22d0f31
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 25, 2024
35b90d1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 25, 2024
c651a21
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 15, 2025
f63547d
Update order tests
samuael Jan 15, 2025
28cb5f7
Complete updating the order unit tests
samuael Jan 16, 2025
a9e4022
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 16, 2025
f99e424
Updating exchange wrapper and test template files
samuael Jan 16, 2025
5975355
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 20, 2025
f708de2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 20, 2025
2f09ca0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 31, 2025
7e9bcc0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 6, 2025
630df5a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 10, 2025
9fe9504
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 10, 2025
c2c59e4
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 17, 2025
6828343
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 17, 2025
fb1c4e0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 18, 2025
41de4e8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 18, 2025
addf572
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 20, 2025
84445fc
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 20, 2025
745977b
update kucoin and deribit wrapper to match the time in force change
samuael Feb 20, 2025
fcd0e4a
minor comment update
samuael Feb 20, 2025
b05fe7f
fix time-in-force related test errors
samuael Feb 20, 2025
2085156
linter issue fix
samuael Feb 20, 2025
971a3ac
ADD_NEW_EXCHANGE documentation update
samuael Feb 20, 2025
de494ac
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 24, 2025
0efc8c8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 24, 2025
889c7cc
time in force constants, functions and unit tests update
samuael Feb 25, 2025
83b6521
shift tif policies to TimeInForce
samuael Feb 28, 2025
9bef751
Update time-in-force, related functions, and unit tests
samuael Mar 3, 2025
18ed556
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 3, 2025
0fbaad8
fix linter issue and time-in-force processing
samuael Mar 4, 2025
892ff5e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 4, 2025
8921ebe
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 4, 2025
88584b8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 7, 2025
0cf66a2
added a good till crossing tif value
samuael Mar 8, 2025
1679be7
order type fix and fix related tim-in-force entries
samuael Mar 9, 2025
3f752f2
update time-in-force unmarshaling and unit test
samuael Mar 10, 2025
8733ed4
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 10, 2025
ddecf99
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 11, 2025
9535fec
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 11, 2025
9b73f05
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 13, 2025
35f37d7
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 13, 2025
736b6fa
consistency guideline added
samuael Mar 15, 2025
7bd0b68
fix time-in-force error in gateio
samuael Mar 17, 2025
26f6f8d
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 17, 2025
0b2f5e2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 18, 2025
7fb6142
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 20, 2025
451bcf8
linter issue fix
samuael Mar 20, 2025
fdcd5e6
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 20, 2025
fc9c4a8
update based on review comments
samuael Mar 24, 2025
ed5e9c8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 25, 2025
d4e9fa4
add unit test and fix missing issues
samuael Mar 25, 2025
a128e9c
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Mar 25, 2025
deb4eff
minor fix and added benchmark unit test
samuael Mar 26, 2025
a645754
change GTT to GTC for limit
samuael Apr 2, 2025
8346856
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 2, 2025
274db9a
fix linter issue
samuael Apr 2, 2025
e02e785
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 2, 2025
e958584
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 7, 2025
3f370b2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 7, 2025
14134b1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 10, 2025
5a54221
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 10, 2025
744efad
added time-in-force value to place order param
samuael Apr 10, 2025
7a52b70
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 11, 2025
ebff2ae
Merge branch 'update_tif' into template_update
samuael Apr 11, 2025
3d806e5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 15, 2025
5129139
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 15, 2025
2b088d0
fix minor issues based on review comment and move tif code to separat…
samuael Apr 15, 2025
0d22549
update on exchanges linked to time-in-force
samuael Apr 15, 2025
dfdbdfc
resolve missing review comments
samuael Apr 15, 2025
84eb5b5
minor linter issues fix
samuael Apr 15, 2025
a9a4bb1
added time-in-force handler and update timeInForce parametered endpoint
samuael Apr 15, 2025
a2b5dde
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 17, 2025
36b22b5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 17, 2025
286aefd
minor fixes based on review
samuael Apr 17, 2025
b25a7c7
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 22, 2025
7fb97d5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Apr 24, 2025
6a6e466
nits fix
samuael Apr 29, 2025
0b5bb56
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 1, 2025
f09c0b9
update based on review
samuael May 1, 2025
9659775
linter fix
samuael May 1, 2025
ad6f761
rm getTimeInForce func and minor change to time-in-force
samuael May 2, 2025
f9e756c
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 2, 2025
e6d375b
Merge branch 'update_tif' into template_update
samuael May 2, 2025
21cd947
minor change
samuael May 2, 2025
89ff36a
update based on review comments
samuael May 6, 2025
31668c0
wrappers and time-in-force calling approach
samuael May 7, 2025
764eb37
minor change
samuael May 8, 2025
3a21dc4
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 8, 2025
9c6f10d
update gateio string to timeInForce conversion and unit test
samuael May 10, 2025
84dc671
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 10, 2025
b343762
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 10, 2025
22dcdec
Merge branch 'update_tif' into template_update
samuael May 10, 2025
af9c178
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 20, 2025
ca5e796
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 25, 2025
1b5dd75
update exchange template
samuael May 27, 2025
d7b8a6f
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 27, 2025
729c1d9
update wrapper template file
samuael May 27, 2025
e59db3b
policy comments, and template files update
samuael May 27, 2025
94121e7
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 3, 2025
56c2644
rename all exchange types name to Exchange
samuael Jun 3, 2025
b332dea
update on template files and template generation
samuael Jun 3, 2025
06f323a
templates and generation code and other updates
samuael Jun 5, 2025
7ca9f64
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 11, 2025
c2aa9a7
linter issue fix
samuael Jun 11, 2025
99a6067
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 12, 2025
34b9577
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 13, 2025
f159410
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 16, 2025
682116b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 17, 2025
31dc868
added subscriptions and websocket templates
samuael Jun 18, 2025
8a29dd2
update ADD_NEW_EXCHANGE.md with recent binance functions and implemen…
samuael Jun 18, 2025
852d44f
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 18, 2025
55b7539
rename template files and update unit tests
samuael Jun 19, 2025
31b0b4b
minor template and unit test fix
samuael Jun 20, 2025
1b65754
rename templates and fix on unit tests
samuael Jun 22, 2025
f2024f0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 24, 2025
bbdbcb6
update on template files and documentation
samuael Jun 24, 2025
a3b7267
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 25, 2025
e3927ce
removed unnecessary tag fix and update templates
samuael Jun 25, 2025
c9a7abe
fix Add_NEW_EXCHANGE.md doc file
samuael Jun 26, 2025
206809a
formatting, comments, and error checks update on template files
samuael Jun 30, 2025
17fffe3
rename exchange receivers to e and ex for consistency
samuael Jun 30, 2025
494b978
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 1, 2025
06764e7
rename unit test exchange receiver and minor updates
samuael Jul 1, 2025
60a58aa
linter issues fix
samuael Jul 1, 2025
5c831b3
fix deribit issue and minor style update
samuael Jul 3, 2025
9dcba06
fix test issues caused by receiver change
samuael Jul 4, 2025
c8dacb9
raname local variables exchange declaration variables
samuael Jul 5, 2025
fd07039
update templates comments
samuael Jul 7, 2025
20d8897
update templates and related comments
samuael Jul 8, 2025
eccce94
renamed ex to e
samuael Jul 8, 2025
8f6bdb2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 8, 2025
0f7df23
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 11, 2025
f0e0f07
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 14, 2025
837b782
update template comments
samuael Jul 14, 2025
ae2f8f6
toggle WS to false to improve coverage
samuael Jul 15, 2025
da4bc56
template comments update
samuael Jul 15, 2025
e67d9da
added test coverage to Ws enabled and minor changes
samuael Jul 16, 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
9 changes: 0 additions & 9 deletions cmd/exchange_template/exchange_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ func main() {
if err != nil {
log.Fatal(err)
}

fmt.Println(`GoCryptoTrader: Exchange templating tool service complete
Add appropriate exchange config settings, particularly enabled and available assets and pairs, to config_example.json for proper functionality (it has been automatically be added to testdata/configtest.json)
When the exchange code implementation has been completed (REST/Websocket/wrappers and tests), please add the exchange to engine/exchange.go
Increment the available exchanges counter in config/config_test.go
Add the exchange name to exchanges/support.go
Ensure go test ./... -race passes
Open a pull request
If help is needed, please post a message in Slack.`)
}

func checkExchangeName(exchName string) error {
Expand Down
12 changes: 6 additions & 6 deletions cmd/exchange_template/rest.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Exchange struct {
}

const (
apiURL = ""
apiURL = ""
apiVersion = ""

// Public endpoints
Expand All @@ -26,8 +26,8 @@ const (
// SendHTTPRequest sends an unauthenticated HTTP request
func (e *Exchange) SendHTTPRequest(ctx context.Context, path string, result any) error {
// This is used to generate the *http.Request, used in conjunction with the
// generate functionality below.
item := &request.Item{
// generate functionality below.
item := &request.Item{
Method: http.MethodGet,
Path: path,
Result: result,
Expand All @@ -37,12 +37,12 @@ func (e *Exchange) SendHTTPRequest(ctx context.Context, path string, result any)
}

// Request function that closes over the above request.Item values, which
// executes on every attempt after rate limiting.
// executes on every attempt after rate limiting.
generate := func() (*request.Item, error) { return item, nil }

endpoint := request.Unset // Used in conjunction with the rate limiting
endpoint := request.Unset // Used in conjunction with the rate limiting
// system defined in the exchange package to slow down outbound requests
// depending on each individual endpoint.
// depending on each individual endpoint.
return e.SendPayload(ctx, endpoint, generate, request.UnauthenticatedRequest)
}

Expand Down
1 change: 0 additions & 1 deletion cmd/exchange_template/subscriptions.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ var defaultSubscriptions = subscription.List{
{Enabled: true, Asset: asset.All, Channel: subscription.TickerChannel},
{Enabled: true, Asset: asset.All, Channel: subscription.OrderbookChannel, Interval: kline.HundredMilliseconds},
}

{{end}}
7 changes: 4 additions & 3 deletions cmd/exchange_template/types.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{define "types"}}
package {{.Name}}
{{end}}
For efficiency, a JSON to Golang converter can be used: https://mholt.github.io/json-to-go/.
/* For efficiency, a JSON to Golang converter can be used: https://mholt.github.io/json-to-go/.
However, great care must be taken as to the values which are autogenerated. The JSON converter tool will default to whatever type it detects,
but ultimately conversions to a more useful variable type would be better. For example, price and quantity on some exchange API's provide these as strings. Internally,
it would be better if they're converted to the more useful float64 var type.
it would be better if they're converted to the more useful float64 var type.
*/
{{end}}
22 changes: 10 additions & 12 deletions cmd/exchange_template/websocket.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ func (e *Exchange) WsConnect() error {
if !e.Websocket.IsEnabled() || !e.IsEnabled() {
return websocket.ErrWebsocketNotEnabled
}
var dialer gws.Dialer
dialer.HandshakeTimeout = e.Config.HTTPTimeout
dialer.Proxy = http.ProxyFromEnvironment

dialer := gws.Dialer{
HandshakeTimeout: e.Config.HTTPTimeout,
Proxy: http.ProxyFromEnvironment,
}

if e.Websocket.CanUseAuthenticatedEndpoints() {
// Add WebSocket authentication logic here.
// Add WebSocket authentication logic here.
}

err := e.Websocket.Conn.Dial(ctx, &dialer, http.Header{})
if err != nil {
if err := e.Websocket.Conn.Dial(ctx, &dialer, http.Header{}); err != nil {
return fmt.Errorf("%v - Unable to connect to Websocket. Error: %s", e.Name, err)
}

Expand All @@ -39,7 +39,6 @@ func (e *Exchange) WsConnect() error {
return nil
}


// Subscribe sends a websocket message to receive data from the channel
Copy link
Collaborator

Choose a reason for hiding this comment

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

🐒 Note: There was a change to the comment here. But in hindsight I'm not happy with that suggestion either. Just a minor update to plurarity.

Suggested change
// Subscribe sends a websocket message to receive data from the channel
// Subscribe sends websocket messages to receive data for a list of channels

func (e *Exchange) Subscribe(_ subscription.List) error {
// ctx := context.TODO()
Expand All @@ -60,16 +59,15 @@ func (e *Exchange) wsReadData(ctx context.Context) {
if resp.Raw == nil {
return
}
err := e.wsHandleData(ctx, resp.Raw)
if err != nil {
// e.Websocket.DataHandler <- err
if err := e.wsHandleData(ctx, resp.Raw); err != nil {
// e.Websocket.DataHandler &lt;- err
}
}
}

// wsHandleData processes a websocket incoming data.
func (e *Exchange) wsHandleData(ctx context.Context, respData []byte) error {
// Implement message parsing and handling logic here.
// Implement message parsing and handling logic here.
return nil
}

Expand Down
Loading
Loading