From 2fd4f5ec5b938aff57e11baa8177787758eb14ca Mon Sep 17 00:00:00 2001 From: cranktakular <43227667+cranktakular@users.noreply.github.com> Date: Tue, 11 Nov 2025 11:07:26 +1100 Subject: [PATCH] cmd/exchange_template: Update wrapper template, improve documentation (#2009) * Updating wrapper template, updating documentation, regenerating documentation * Renaming "streaming api" to "websocket" * Context is now t * Update docs/ADD_NEW_EXCHANGE.md Co-authored-by: Adrian Gallagher * Update cmd/documentation/root_templates/root_readme.tmpl Co-authored-by: Adrian Gallagher * Fixes an improper example and regenerates documentation * Corrects typos * Makes a table label consistent across files --------- Co-authored-by: Adrian Gallagher --- CONTRIBUTORS | 41 +++++++----- README.md | 56 ++++++++++------- .../exchanges_templates/binance.tmpl | 2 +- .../exchanges_templates/binanceus.tmpl | 2 +- .../exchanges_templates/bitfinex.tmpl | 2 +- .../exchanges_templates/bitflyer.tmpl | 2 +- .../exchanges_templates/bithumb.tmpl | 2 +- .../exchanges_templates/bitmex.tmpl | 2 +- .../exchanges_templates/bitstamp.tmpl | 2 +- .../exchanges_templates/btcmarkets.tmpl | 2 +- .../exchanges_templates/btse.tmpl | 2 +- .../exchanges_templates/bybit.tmpl | 2 +- .../exchanges_templates/coinbase.tmpl | 2 +- .../exchanges_templates/coinut.tmpl | 2 +- .../exchanges_templates/deribit.tmpl | 2 +- .../exchanges_templates/exmo.tmpl | 2 +- .../exchanges_templates/gateio.tmpl | 2 +- .../exchanges_templates/gemini.tmpl | 2 +- .../exchanges_templates/hitbtc.tmpl | 2 +- .../exchanges_templates/huobi.tmpl | 2 +- .../exchanges_templates/kraken.tmpl | 2 +- .../exchanges_templates/lbank.tmpl | 2 +- .../exchanges_templates/okx.tmpl | 2 +- .../exchanges_templates/poloniex.tmpl | 2 +- .../exchanges_templates/yobit.tmpl | 2 +- .../root_templates/root_readme.tmpl | 3 +- cmd/exchange_template/wrapper.tmpl | 8 +-- dispatch/dispatch_types.go | 2 +- docs/ADD_NEW_EXCHANGE.md | 63 +++++++------------ docs/CODING_GUIDELINES.md | 2 +- engine/currency_state_manager.md | 22 +++---- exchanges/binance/README.md | 2 +- exchanges/binanceus/README.md | 2 +- exchanges/bitfinex/README.md | 2 +- exchanges/bitflyer/README.md | 2 +- exchanges/bithumb/README.md | 2 +- exchanges/bitmex/README.md | 2 +- exchanges/bitstamp/README.md | 2 +- exchanges/btcmarkets/README.md | 2 +- exchanges/btse/README.md | 2 +- exchanges/bybit/README.md | 2 +- exchanges/coinbase/README.md | 4 +- exchanges/coinut/README.md | 2 +- exchanges/deribit/README.md | 2 +- exchanges/exmo/README.md | 2 +- exchanges/gateio/README.md | 2 +- exchanges/gemini/README.md | 2 +- exchanges/hitbtc/README.md | 2 +- exchanges/huobi/README.md | 2 +- exchanges/kraken/README.md | 2 +- exchanges/lbank/README.md | 2 +- exchanges/okx/README.md | 2 +- exchanges/poloniex/README.md | 2 +- exchanges/yobit/README.md | 2 +- 54 files changed, 145 insertions(+), 146 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e025dd3d..de87d374 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -10,33 +10,33 @@ xtda | https://github.com/xtda lrascao | https://github.com/lrascao Beadko | https://github.com/Beadko samuael | https://github.com/samuael -ydm | https://github.com/ydm vazha | https://github.com/vazha +ydm | https://github.com/ydm Rots | https://github.com/Rots ermalguni | https://github.com/ermalguni MadCozBadd | https://github.com/MadCozBadd +Copilot | https://github.com/apps/copilot-swe-agent vadimzhukck | https://github.com/vadimzhukck junnplus | https://github.com/junnplus geseq | https://github.com/geseq marcofranssen | https://github.com/marcofranssen 140am | https://github.com/140am -TaltaM | https://github.com/TaltaM cranktakular | https://github.com/cranktakular +TaltaM | https://github.com/TaltaM dackroyd | https://github.com/dackroyd khcchiu | https://github.com/khcchiu yangrq1018 | https://github.com/yangrq1018 -crackcomm | https://github.com/crackcomm -romanornr | https://github.com/romanornr woshidama323 | https://github.com/woshidama323 -Copilot | https://github.com/apps/copilot-swe-agent -mshogin | https://github.com/mshogin -herenow | https://github.com/herenow -tk42 | https://github.com/tk42 -soxipy | https://github.com/soxipy -Asalei | https://github.com/Asalei -lozdog245 | https://github.com/lozdog245 -if1live | https://github.com/if1live +romanornr | https://github.com/romanornr +crackcomm | https://github.com/crackcomm azhang | https://github.com/azhang +if1live | https://github.com/if1live +lozdog245 | https://github.com/lozdog245 +Asalei | https://github.com/Asalei +soxipy | https://github.com/soxipy +tk42 | https://github.com/tk42 +herenow | https://github.com/herenow +mshogin | https://github.com/mshogin andreygrehov | https://github.com/andreygrehov bretep | https://github.com/bretep Christian-Achilli | https://github.com/Christian-Achilli @@ -44,8 +44,8 @@ dsinuela-taurus | https://github.com/dsinuela-taurus cornelk | https://github.com/cornelk gam-phon | https://github.com/gam-phon MarkDzulko | https://github.com/MarkDzulko -mortensorensen | https://github.com/mortensorensen -cavapoo2 | https://github.com/cavapoo2 +MathieuCesbron | https://github.com/MathieuCesbron +aidan-bailey | https://github.com/aidan-bailey tongxiaofeng | https://github.com/tongxiaofeng tonywangcn | https://github.com/tonywangcn varunbhat | https://github.com/varunbhat @@ -55,17 +55,21 @@ vyloy | https://github.com/vyloy arttobe | https://github.com/arttobe shoman4eg | https://github.com/shoman4eg cangqiaoyuzhuo | https://github.com/cangqiaoyuzhuo +dazi005 | https://github.com/dazi005 gcmutator | https://github.com/gcmutator gopherorg | https://github.com/gopherorg -yuhangcangqian | https://github.com/yuhangcangqian whilei | https://github.com/whilei -xiiiew | https://github.com/xiiiew +yuhangcangqian | https://github.com/yuhangcangqian +keeghcet | https://github.com/keeghcet +mickychang9 | https://github.com/mickychang9 phieudu241 | https://github.com/phieudu241 +quantpoet | https://github.com/quantpoet snipesjr | https://github.com/snipesjr snussik | https://github.com/snussik taewdy | https://github.com/taewdy threehonor | https://github.com/threehonor -aidan-bailey | https://github.com/aidan-bailey +xiiiew | https://github.com/xiiiew +youzichuan | https://github.com/youzichuan antonzhukov | https://github.com/antonzhukov blombard | https://github.com/blombard CodeLingoBot | https://github.com/CodeLingoBot @@ -89,5 +93,8 @@ mattkanwisher | https://github.com/mattkanwisher mgravitt | https://github.com/mgravitt mKurrels | https://github.com/mKurrels m1kola | https://github.com/m1kola +mortensorensen | https://github.com/mortensorensen +Polizo96 | https://github.com/Polizo96 +cavapoo2 | https://github.com/cavapoo2 idoall | https://github.com/idoall starit | https://github.com/starit diff --git a/README.md b/README.md index 19773b3c..71b66db1 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader ## Exchange Support Table -| Exchange | REST API | Streaming API | FIX API | +| Exchange | REST API | Websocket API | FIX API | +`` |----------|------|-----------|-----| | Binance.US| Yes | Yes | NA | | Binance| Yes | Yes | NA | @@ -149,43 +150,43 @@ Binaries will be published once the codebase reaches a stable condition. |User|Contribution Amount| |--|--| -| [thrasher-](https://github.com/thrasher-) | 731 | -| [dependabot[bot]](https://github.com/apps/dependabot) | 386 | -| [shazbert](https://github.com/shazbert) | 374 | -| [gloriousCode](https://github.com/gloriousCode) | 237 | -| [gbjk](https://github.com/gbjk) | 133 | +| [thrasher-](https://github.com/thrasher-) | 737 | +| [dependabot[bot]](https://github.com/apps/dependabot) | 415 | +| [shazbert](https://github.com/shazbert) | 389 | +| [gloriousCode](https://github.com/gloriousCode) | 240 | +| [gbjk](https://github.com/gbjk) | 143 | | [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 88 | | [xtda](https://github.com/xtda) | 47 | | [lrascao](https://github.com/lrascao) | 27 | | [Beadko](https://github.com/Beadko) | 24 | -| [samuael](https://github.com/samuael) | 15 | -| [ydm](https://github.com/ydm) | 15 | +| [samuael](https://github.com/samuael) | 16 | | [vazha](https://github.com/vazha) | 15 | +| [ydm](https://github.com/ydm) | 15 | | [Rots](https://github.com/Rots) | 15 | | [ermalguni](https://github.com/ermalguni) | 14 | | [MadCozBadd](https://github.com/MadCozBadd) | 13 | +| [Copilot](https://github.com/apps/copilot-swe-agent) | 13 | | [vadimzhukck](https://github.com/vadimzhukck) | 10 | | [junnplus](https://github.com/junnplus) | 9 | | [geseq](https://github.com/geseq) | 8 | | [marcofranssen](https://github.com/marcofranssen) | 8 | | [140am](https://github.com/140am) | 8 | +| [cranktakular](https://github.com/cranktakular) | 7 | | [TaltaM](https://github.com/TaltaM) | 6 | -| [cranktakular](https://github.com/cranktakular) | 6 | | [dackroyd](https://github.com/dackroyd) | 5 | | [khcchiu](https://github.com/khcchiu) | 5 | | [yangrq1018](https://github.com/yangrq1018) | 4 | -| [crackcomm](https://github.com/crackcomm) | 3 | -| [romanornr](https://github.com/romanornr) | 3 | | [woshidama323](https://github.com/woshidama323) | 3 | -| [Copilot](https://github.com/apps/copilot-swe-agent) | 3 | -| [mshogin](https://github.com/mshogin) | 2 | -| [herenow](https://github.com/herenow) | 2 | -| [tk42](https://github.com/tk42) | 2 | -| [soxipy](https://github.com/soxipy) | 2 | -| [Asalei](https://github.com/Asalei) | 2 | -| [lozdog245](https://github.com/lozdog245) | 2 | -| [if1live](https://github.com/if1live) | 2 | +| [romanornr](https://github.com/romanornr) | 3 | +| [crackcomm](https://github.com/crackcomm) | 3 | | [azhang](https://github.com/azhang) | 2 | +| [if1live](https://github.com/if1live) | 2 | +| [lozdog245](https://github.com/lozdog245) | 2 | +| [Asalei](https://github.com/Asalei) | 2 | +| [soxipy](https://github.com/soxipy) | 2 | +| [tk42](https://github.com/tk42) | 2 | +| [herenow](https://github.com/herenow) | 2 | +| [mshogin](https://github.com/mshogin) | 2 | | [andreygrehov](https://github.com/andreygrehov) | 2 | | [bretep](https://github.com/bretep) | 2 | | [Christian-Achilli](https://github.com/Christian-Achilli) | 2 | @@ -193,8 +194,8 @@ Binaries will be published once the codebase reaches a stable condition. | [cornelk](https://github.com/cornelk) | 2 | | [gam-phon](https://github.com/gam-phon) | 2 | | [MarkDzulko](https://github.com/MarkDzulko) | 2 | -| [mortensorensen](https://github.com/mortensorensen) | 1 | -| [cavapoo2](https://github.com/cavapoo2) | 1 | +| [MathieuCesbron](https://github.com/MathieuCesbron) | 2 | +| [aidan-bailey](https://github.com/aidan-bailey) | 1 | | [tongxiaofeng](https://github.com/tongxiaofeng) | 1 | | [tonywangcn](https://github.com/tonywangcn) | 1 | | [varunbhat](https://github.com/varunbhat) | 1 | @@ -204,17 +205,21 @@ Binaries will be published once the codebase reaches a stable condition. | [arttobe](https://github.com/arttobe) | 1 | | [shoman4eg](https://github.com/shoman4eg) | 1 | | [cangqiaoyuzhuo](https://github.com/cangqiaoyuzhuo) | 1 | +| [dazi005](https://github.com/dazi005) | 1 | | [gcmutator](https://github.com/gcmutator) | 1 | | [gopherorg](https://github.com/gopherorg) | 1 | -| [yuhangcangqian](https://github.com/yuhangcangqian) | 1 | | [whilei](https://github.com/whilei) | 1 | -| [xiiiew](https://github.com/xiiiew) | 1 | +| [yuhangcangqian](https://github.com/yuhangcangqian) | 1 | +| [keeghcet](https://github.com/keeghcet) | 1 | +| [mickychang9](https://github.com/mickychang9) | 1 | | [phieudu241](https://github.com/phieudu241) | 1 | +| [quantpoet](https://github.com/quantpoet) | 1 | | [snipesjr](https://github.com/snipesjr) | 1 | | [snussik](https://github.com/snussik) | 1 | | [taewdy](https://github.com/taewdy) | 1 | | [threehonor](https://github.com/threehonor) | 1 | -| [aidan-bailey](https://github.com/aidan-bailey) | 1 | +| [xiiiew](https://github.com/xiiiew) | 1 | +| [youzichuan](https://github.com/youzichuan) | 1 | | [antonzhukov](https://github.com/antonzhukov) | 1 | | [blombard](https://github.com/blombard) | 1 | | [CodeLingoBot](https://github.com/CodeLingoBot) | 1 | @@ -238,5 +243,8 @@ Binaries will be published once the codebase reaches a stable condition. | [mgravitt](https://github.com/mgravitt) | 1 | | [mKurrels](https://github.com/mKurrels) | 1 | | [m1kola](https://github.com/m1kola) | 1 | +| [mortensorensen](https://github.com/mortensorensen) | 1 | +| [Polizo96](https://github.com/Polizo96) | 1 | +| [cavapoo2](https://github.com/cavapoo2) | 1 | | [idoall](https://github.com/idoall) | 1 | | [starit](https://github.com/starit) | 1 | diff --git a/cmd/documentation/exchanges_templates/binance.tmpl b/cmd/documentation/exchanges_templates/binance.tmpl index b49748fa..694af686 100644 --- a/cmd/documentation/exchanges_templates/binance.tmpl +++ b/cmd/documentation/exchanges_templates/binance.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/binanceus.tmpl b/cmd/documentation/exchanges_templates/binanceus.tmpl index 09b74c54..3cd08af1 100644 --- a/cmd/documentation/exchanges_templates/binanceus.tmpl +++ b/cmd/documentation/exchanges_templates/binanceus.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/bitfinex.tmpl b/cmd/documentation/exchanges_templates/bitfinex.tmpl index 623ce05c..eb754200 100644 --- a/cmd/documentation/exchanges_templates/bitfinex.tmpl +++ b/cmd/documentation/exchanges_templates/bitfinex.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/bitflyer.tmpl b/cmd/documentation/exchanges_templates/bitflyer.tmpl index cd62d69b..f4df082c 100644 --- a/cmd/documentation/exchanges_templates/bitflyer.tmpl +++ b/cmd/documentation/exchanges_templates/bitflyer.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/bithumb.tmpl b/cmd/documentation/exchanges_templates/bithumb.tmpl index 735c9599..cbdce975 100644 --- a/cmd/documentation/exchanges_templates/bithumb.tmpl +++ b/cmd/documentation/exchanges_templates/bithumb.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/bitmex.tmpl b/cmd/documentation/exchanges_templates/bitmex.tmpl index e3c6c372..82df8803 100644 --- a/cmd/documentation/exchanges_templates/bitmex.tmpl +++ b/cmd/documentation/exchanges_templates/bitmex.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/bitstamp.tmpl b/cmd/documentation/exchanges_templates/bitstamp.tmpl index 0228e80a..1ac63df0 100644 --- a/cmd/documentation/exchanges_templates/bitstamp.tmpl +++ b/cmd/documentation/exchanges_templates/bitstamp.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/btcmarkets.tmpl b/cmd/documentation/exchanges_templates/btcmarkets.tmpl index 9de83b08..9524cd76 100644 --- a/cmd/documentation/exchanges_templates/btcmarkets.tmpl +++ b/cmd/documentation/exchanges_templates/btcmarkets.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/btse.tmpl b/cmd/documentation/exchanges_templates/btse.tmpl index bf32464b..6b451aa4 100644 --- a/cmd/documentation/exchanges_templates/btse.tmpl +++ b/cmd/documentation/exchanges_templates/btse.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/bybit.tmpl b/cmd/documentation/exchanges_templates/bybit.tmpl index 50fec8af..fbe13246 100644 --- a/cmd/documentation/exchanges_templates/bybit.tmpl +++ b/cmd/documentation/exchanges_templates/bybit.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/coinbase.tmpl b/cmd/documentation/exchanges_templates/coinbase.tmpl index aae8ccf9..2ae8a701 100644 --- a/cmd/documentation/exchanges_templates/coinbase.tmpl +++ b/cmd/documentation/exchanges_templates/coinbase.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := c.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/coinut.tmpl b/cmd/documentation/exchanges_templates/coinut.tmpl index 053a551e..bd275bb2 100644 --- a/cmd/documentation/exchanges_templates/coinut.tmpl +++ b/cmd/documentation/exchanges_templates/coinut.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := c.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/deribit.tmpl b/cmd/documentation/exchanges_templates/deribit.tmpl index 63bfda4d..0c65c5e3 100644 --- a/cmd/documentation/exchanges_templates/deribit.tmpl +++ b/cmd/documentation/exchanges_templates/deribit.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := d.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/exmo.tmpl b/cmd/documentation/exchanges_templates/exmo.tmpl index 5f2b635b..3998783d 100644 --- a/cmd/documentation/exchanges_templates/exmo.tmpl +++ b/cmd/documentation/exchanges_templates/exmo.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := e.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/gateio.tmpl b/cmd/documentation/exchanges_templates/gateio.tmpl index b050df74..23f9e882 100644 --- a/cmd/documentation/exchanges_templates/gateio.tmpl +++ b/cmd/documentation/exchanges_templates/gateio.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := g.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/gemini.tmpl b/cmd/documentation/exchanges_templates/gemini.tmpl index 7d5c683f..71a950fa 100644 --- a/cmd/documentation/exchanges_templates/gemini.tmpl +++ b/cmd/documentation/exchanges_templates/gemini.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := g.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/hitbtc.tmpl b/cmd/documentation/exchanges_templates/hitbtc.tmpl index 312f0dea..74b784b6 100644 --- a/cmd/documentation/exchanges_templates/hitbtc.tmpl +++ b/cmd/documentation/exchanges_templates/hitbtc.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := h.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/huobi.tmpl b/cmd/documentation/exchanges_templates/huobi.tmpl index 29743031..de1c1e35 100644 --- a/cmd/documentation/exchanges_templates/huobi.tmpl +++ b/cmd/documentation/exchanges_templates/huobi.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := h.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/kraken.tmpl b/cmd/documentation/exchanges_templates/kraken.tmpl index 73dd56bc..a194afa4 100644 --- a/cmd/documentation/exchanges_templates/kraken.tmpl +++ b/cmd/documentation/exchanges_templates/kraken.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := k.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/lbank.tmpl b/cmd/documentation/exchanges_templates/lbank.tmpl index af3c30d5..ec66aa31 100644 --- a/cmd/documentation/exchanges_templates/lbank.tmpl +++ b/cmd/documentation/exchanges_templates/lbank.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := l.Trade(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/okx.tmpl b/cmd/documentation/exchanges_templates/okx.tmpl index 3a172801..41a55c27 100644 --- a/cmd/documentation/exchanges_templates/okx.tmpl +++ b/cmd/documentation/exchanges_templates/okx.tmpl @@ -93,7 +93,7 @@ if err != nil { // Private calls - make sure your APIKEY and APISECRET are set and // AuthenticatedAPISupport is set to true -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID orderID, err := ok.SubmitOrder(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/poloniex.tmpl b/cmd/documentation/exchanges_templates/poloniex.tmpl index 2d7cf59f..84179b59 100644 --- a/cmd/documentation/exchanges_templates/poloniex.tmpl +++ b/cmd/documentation/exchanges_templates/poloniex.tmpl @@ -86,7 +86,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := p.PlaceOrder(...) if err != nil { // Handle error diff --git a/cmd/documentation/exchanges_templates/yobit.tmpl b/cmd/documentation/exchanges_templates/yobit.tmpl index e1ba496b..be368ecc 100644 --- a/cmd/documentation/exchanges_templates/yobit.tmpl +++ b/cmd/documentation/exchanges_templates/yobit.tmpl @@ -85,7 +85,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := y.Trade("BTCUSD", "MARKET", 1, 2) if err != nil { // Handle error diff --git a/cmd/documentation/root_templates/root_readme.tmpl b/cmd/documentation/root_templates/root_readme.tmpl index c59fac51..b85c0a5f 100644 --- a/cmd/documentation/root_templates/root_readme.tmpl +++ b/cmd/documentation/root_templates/root_readme.tmpl @@ -17,7 +17,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader ## Exchange Support Table -| Exchange | REST API | Streaming API | FIX API | +| Exchange | REST API | Websocket API | FIX API | +`` |----------|------|-----------|-----| | Binance.US| Yes | Yes | NA | | Binance| Yes | Yes | NA | diff --git a/cmd/exchange_template/wrapper.tmpl b/cmd/exchange_template/wrapper.tmpl index 46fee71c..28aa3db5 100644 --- a/cmd/exchange_template/wrapper.tmpl +++ b/cmd/exchange_template/wrapper.tmpl @@ -53,14 +53,14 @@ func (e *Exchange) SetDefaults() { fmt1 := currency.PairStore{ AssetEnabled: true, - RequestFormat: ¤cy.PairFormat{Uppercase: true}, - ConfigFormat: ¤cy.PairFormat{Uppercase: true}, + RequestFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "_"}, + ConfigFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "_"}, } fmt2 := currency.PairStore{ AssetEnabled: true, - RequestFormat: ¤cy.PairFormat{Uppercase: true}, - ConfigFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: ":"}, + RequestFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "-"}, + ConfigFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "_"}, } if err := e.SetAssetPairStore(asset.Spot, fmt1); err != nil { diff --git a/dispatch/dispatch_types.go b/dispatch/dispatch_types.go index 2f65651f..77149da1 100644 --- a/dispatch/dispatch_types.go +++ b/dispatch/dispatch_types.go @@ -65,7 +65,7 @@ type job struct { ID uuid.UUID } -// Mux defines a new multiplexer for the dispatch system, these a generated +// Mux defines a new multiplexer for the dispatch system, these are generated // per subsystem type Mux struct { // Reference to the main running dispatch service diff --git a/docs/ADD_NEW_EXCHANGE.md b/docs/ADD_NEW_EXCHANGE.md index ac630590..38c79f5b 100644 --- a/docs/ADD_NEW_EXCHANGE.md +++ b/docs/ADD_NEW_EXCHANGE.md @@ -22,7 +22,7 @@ This document is from a perspective of adding a new exchange called Binance to t #### Linux/macOS -GoCryptoTrader is built using [Go Modules](https://github.com/golang/go/wiki/Modules) and requires Go 1.11 or above +GoCryptoTrader is built using [Go Modules](https://go.dev/wiki/Modules) and requires Go 1.11 or above Using Go Modules you now clone this repository **outside** your GOPATH ```console @@ -90,48 +90,34 @@ go build && gocryptotrader.exe --config=config_example.json Similar to the configs, spot support is inbuilt but other asset types will need to be manually supported ```go - spot := currency.PairStore{ - AssetEnabled: true, - RequestFormat: ¤cy.PairFormat{ - Uppercase: true, - Delimiter: "/", - }, - ConfigFormat: ¤cy.PairFormat{ - Uppercase: true, - Delimiter: "/", - }, - } - futures := currency.PairStore{ - AssetEnabled: true, - RequestFormat: ¤cy.PairFormat{ - Uppercase: true, - Delimiter: "-", - }, - ConfigFormat: ¤cy.PairFormat{ - Uppercase: true, - Delimiter: "-", - }, - } + fmt1 := currency.PairStore{ + AssetEnabled: true, + RequestFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "_"}, + ConfigFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "_"}, + } - err := e.SetAssetPairStore(asset.Spot, spot) - if err != nil { - log.Errorf(log.ExchangeSys, "%s error storing `spot` default asset formats: %s", bi.Name, err) - } + fmt2 := currency.PairStore{ + AssetEnabled: true, + RequestFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "-"}, + ConfigFormat: ¤cy.PairFormat{Uppercase: true, Delimiter: "_"}, + } - err = e.SetAssetPairStore(asset.Futures, futures) - if err != nil { - log.Errorf(log.ExchangeSys, "%s error storing `futures` default asset formats: %s", bi.Name, err) - } + if err := e.SetAssetPairStore(asset.Spot, fmt1); err != nil { + log.Errorf(log.ExchangeSys, "%s error storing %q default asset formats: %s", e.Name, asset.Spot, err) + } + if err := e.SetAssetPairStore(asset.Futures, fmt2); err != nil { + log.Errorf(log.ExchangeSys, "%s error storing %q default asset formats: %s", e.Name, asset.Futures, err) + } ``` ### Document the addition of the new exchange (Binance exchange is used as an example below) -**Yes** means supported, **No** means not yet implemented and **NA** means protocol unsupported +**Yes** means supported, **No** means not yet implemented and **NA** means protocol unsupported by the exchange #### Add exchange to the [root README template](/cmd/documentation/root_templates/root_readme.tmpl) file ```go -| Exchange | REST API | Streaming API | FIX API | +| Exchange | REST API | Websocket API | FIX API | |----------|------|-----------|-----| | Binance| Yes | Yes | NA | // <-------- new exchange | Bitfinex | Yes | Yes | NA | @@ -320,7 +306,7 @@ Modify existing constants or create new ones to define the API URL paths, as app apiURL = "https://api.binance.com" ``` -Create a get function in `rest.go` file and unmarshall the data in the created type: +Create a get function in the `rest.go` file and unmarshal the data in the created type: ```go // GetExchangeInfo returns exchange information. Check types for more @@ -336,11 +322,8 @@ Create a test function in `rest_test.go` to see if the data is received and unma ```go func TestGetExchangeInfo(t *testing.T) { t.Parallel() // adding t.Parallel() is preferred as it allows tests to run simultaneously, speeding up package test time - // Either set verbose to true for more detailed output as shown below: e.Verbose = true - // Or alternatively you can use: - // result, err := e.GetExchangeInfo(request.WithVerbose(context.Background())) - result, err := e.GetExchangeInfo(context.Background()) + result, err := e.GetExchangeInfo(t.Context()) require.NoError(t, err) t.Log(result) assert.NotNil(t, result) @@ -349,10 +332,10 @@ func TestGetExchangeInfo(t *testing.T) { Set `Verbose` to `true` to view received data during unmarshalling errors. After testing, remove `Verbose`, the result variable, and `t.Log(result)`, or replace the log with `assert.NotNil(t, result)` to avoid unnecessary output when running GCT. -Alternatively you can use `request.WithVerbose(context.Background())` as the `context` param to achieve the same result. +Alternatively you can use `request.WithVerbose(t.Context())` as the `context` param to achieve the same result. ```go - result, err := e.GetExchangeInfo(context.Background()) + result, err := e.GetExchangeInfo(t.Context()) require.NoError(t, err) assert.NotNil(t, result) ``` diff --git a/docs/CODING_GUIDELINES.md b/docs/CODING_GUIDELINES.md index bdd827a2..6c1593f9 100644 --- a/docs/CODING_GUIDELINES.md +++ b/docs/CODING_GUIDELINES.md @@ -193,7 +193,7 @@ Run the following tool to check for Go modernise issues: make modernise ``` -Several other miscellaneous checks will be ran via [GitHub actions](/.github/workflows/misc.yml). +Several other miscellaneous checks will be run via [GitHub actions](/.github/workflows/misc.yml). - All lint warnings and errors must be resolved before merging. - Use `//nolint:linter-name` sparingly and always explain the reason in a comment next to the code. diff --git a/engine/currency_state_manager.md b/engine/currency_state_manager.md index 7dbbe462..5384469d 100644 --- a/engine/currency_state_manager.md +++ b/engine/currency_state_manager.md @@ -17,20 +17,20 @@ This currency_state_manager package is part of the GoCryptoTrader codebase. You can track ideas, planned features and what's in progress on our [GoCryptoTrader Kanban board](https://github.com/orgs/thrasher-corp/projects/3). Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/zt-38z8abs3l-gH8AAOk8XND6DP5NfCiG_g) - -## Current Features for Currency State Manager -+ The state manager keeps currency states up to date, which include: -* Withdrawal - Determines if the currency is allowed to be withdrawn from the exchange. -* Deposit - Determines if the currency is allowed to be deposited to an exchange. -* Trading - Determines if the currency is allowed to be traded on the exchange. - -+ This allows for an internal state check to compliment internal and external -strategies. - + +## Current Features for Currency State Manager ++ The state manager keeps currency states up to date, which include: +* Withdrawal - Determines if the currency is allowed to be withdrawn from the exchange. +* Deposit - Determines if the currency is allowed to be deposited to an exchange. +* Trading - Determines if the currency is allowed to be traded on the exchange. + ++ This allows for an internal state check to compliment internal and external +strategies. + ## Donations If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to: -***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** +***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc*** diff --git a/exchanges/binance/README.md b/exchanges/binance/README.md index bd5047d6..19b92b4f 100644 --- a/exchanges/binance/README.md +++ b/exchanges/binance/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/binanceus/README.md b/exchanges/binanceus/README.md index ce4a7730..bc12d114 100644 --- a/exchanges/binanceus/README.md +++ b/exchanges/binanceus/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/bitfinex/README.md b/exchanges/bitfinex/README.md index 067be4ad..59a97724 100644 --- a/exchanges/bitfinex/README.md +++ b/exchanges/bitfinex/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/bitflyer/README.md b/exchanges/bitflyer/README.md index 34ee9bf2..4abcfbe2 100644 --- a/exchanges/bitflyer/README.md +++ b/exchanges/bitflyer/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/bithumb/README.md b/exchanges/bithumb/README.md index 469722ee..f37e518d 100644 --- a/exchanges/bithumb/README.md +++ b/exchanges/bithumb/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/bitmex/README.md b/exchanges/bitmex/README.md index b8706f5d..4046debf 100644 --- a/exchanges/bitmex/README.md +++ b/exchanges/bitmex/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/bitstamp/README.md b/exchanges/bitstamp/README.md index e2447bbf..5be32c52 100644 --- a/exchanges/bitstamp/README.md +++ b/exchanges/bitstamp/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/btcmarkets/README.md b/exchanges/btcmarkets/README.md index b2094843..f5520e74 100644 --- a/exchanges/btcmarkets/README.md +++ b/exchanges/btcmarkets/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/btse/README.md b/exchanges/btse/README.md index 36c592cd..81165778 100644 --- a/exchanges/btse/README.md +++ b/exchanges/btse/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/bybit/README.md b/exchanges/bybit/README.md index 65323b50..bac560bd 100644 --- a/exchanges/bybit/README.md +++ b/exchanges/bybit/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := b.Trade(...) if err != nil { // Handle error diff --git a/exchanges/coinbase/README.md b/exchanges/coinbase/README.md index 6709c170..28a7ec18 100644 --- a/exchanges/coinbase/README.md +++ b/exchanges/coinbase/README.md @@ -5,7 +5,7 @@ [![Build Status](https://github.com/thrasher-corp/gocryptotrader/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/thrasher-corp/gocryptotrader/actions/workflows/tests.yml) [![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE) -[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/exchanges/Coinbase) +[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/exchanges/coinbase) [![Coverage Status](https://codecov.io/gh/thrasher-corp/gocryptotrader/graph/badge.svg?token=41784B23TS)](https://codecov.io/gh/thrasher-corp/gocryptotrader) [![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader) @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := c.Trade(...) if err != nil { // Handle error diff --git a/exchanges/coinut/README.md b/exchanges/coinut/README.md index 71f5f475..489f0b55 100644 --- a/exchanges/coinut/README.md +++ b/exchanges/coinut/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := c.Trade(...) if err != nil { // Handle error diff --git a/exchanges/deribit/README.md b/exchanges/deribit/README.md index 3f2187e4..bf3dec6a 100644 --- a/exchanges/deribit/README.md +++ b/exchanges/deribit/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := d.Trade(...) if err != nil { // Handle error diff --git a/exchanges/exmo/README.md b/exchanges/exmo/README.md index afa92e11..9a4c005a 100644 --- a/exchanges/exmo/README.md +++ b/exchanges/exmo/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := e.Trade(...) if err != nil { // Handle error diff --git a/exchanges/gateio/README.md b/exchanges/gateio/README.md index 81400390..9c0566e9 100644 --- a/exchanges/gateio/README.md +++ b/exchanges/gateio/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := g.Trade(...) if err != nil { // Handle error diff --git a/exchanges/gemini/README.md b/exchanges/gemini/README.md index ff9ffa30..ddf6e81e 100644 --- a/exchanges/gemini/README.md +++ b/exchanges/gemini/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := g.Trade(...) if err != nil { // Handle error diff --git a/exchanges/hitbtc/README.md b/exchanges/hitbtc/README.md index 3ab052e1..ddc83da3 100644 --- a/exchanges/hitbtc/README.md +++ b/exchanges/hitbtc/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := h.Trade(...) if err != nil { // Handle error diff --git a/exchanges/huobi/README.md b/exchanges/huobi/README.md index c714354a..c7ad17e4 100644 --- a/exchanges/huobi/README.md +++ b/exchanges/huobi/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := h.Trade(...) if err != nil { // Handle error diff --git a/exchanges/kraken/README.md b/exchanges/kraken/README.md index c7403992..98259d28 100644 --- a/exchanges/kraken/README.md +++ b/exchanges/kraken/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := k.Trade(...) if err != nil { // Handle error diff --git a/exchanges/lbank/README.md b/exchanges/lbank/README.md index 5a60b491..b2b9c8b6 100644 --- a/exchanges/lbank/README.md +++ b/exchanges/lbank/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := l.Trade(...) if err != nil { // Handle error diff --git a/exchanges/okx/README.md b/exchanges/okx/README.md index ca182211..c4e5e1ab 100644 --- a/exchanges/okx/README.md +++ b/exchanges/okx/README.md @@ -111,7 +111,7 @@ if err != nil { // Private calls - make sure your APIKEY and APISECRET are set and // AuthenticatedAPISupport is set to true -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID orderID, err := ok.SubmitOrder(...) if err != nil { // Handle error diff --git a/exchanges/poloniex/README.md b/exchanges/poloniex/README.md index 8d47d8ce..f786f46a 100644 --- a/exchanges/poloniex/README.md +++ b/exchanges/poloniex/README.md @@ -104,7 +104,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := p.PlaceOrder(...) if err != nil { // Handle error diff --git a/exchanges/yobit/README.md b/exchanges/yobit/README.md index 0b2d2dbe..94fce0f5 100644 --- a/exchanges/yobit/README.md +++ b/exchanges/yobit/README.md @@ -103,7 +103,7 @@ if err != nil { // Handle error } -// Submits an order and the exchange and returns its tradeID +// Submits an order to the exchange and returns its tradeID tradeID, err := y.Trade("BTCUSD", "MARKET", 1, 2) if err != nil { // Handle error