Skip to content

Commit

Permalink
engine/exchanges: Add exchange currency state subsystem (thrasher-cor…
Browse files Browse the repository at this point in the history
…p#774)

* state: Add management system (init)

* linter: fix

* engine: gofmt

* gct: after merge fixup

* documentation: add

* rpc: implement services for testing

* gctcli: gofmt state_management.go

* documentation: reinstate lost information

* state: Add pair check to determine trading operation

* exchanges: add interface for specific state scoped subsystem functionality

* engine/order_man: reduce code footprint using new method

* RPC: implement pair trading request and change exported name to something specific to state

* engine: add tests

* engine: Add to withdraw manager

* documentation: reinstate soxipy in contrib. list

* engine: const fake name

* Glorious: NITERINOS

* merge: fix issues

* engine: csm incorporate service name into log output

* engine: fix linter issues

* gct: fix tests

* currencystate: remove management type

* rpc: fix tests

* backtester: fix tests

* Update engine/currency_state_manager.go

Co-authored-by: Scott <[email protected]>

* Update engine/currency_state_manager.go

Co-authored-by: Scott <[email protected]>

* Update exchanges/currencystate/currency_state.go

Co-authored-by: Scott <[email protected]>

* Update exchanges/alert/alert.go

Co-authored-by: Scott <[email protected]>

* Update exchanges/alert/alert.go

Co-authored-by: Scott <[email protected]>

* glorious: nits

* config: integrate with config and remove flag delay adjustment

* gctcli: fix issues after name changes

* engine: gofmt manager file

* Update engine/rpcserver.go

Co-authored-by: Scott <[email protected]>

* engine: Add enable/disable manager functions, add default popoulation for potential assets

* linter: fix

* engine/test: bump subsystem count

* Update engine/currency_state_manager.go

Co-authored-by: Scott <[email protected]>

* Update exchanges/bithumb/bithumb.go

Co-authored-by: Scott <[email protected]>

* glorious: nits addressed

* alert: fix commenting for its generalized purpose

* glorious: nits

* engine: use standard string in log output

* bitfinex: apply patch, thanks @thrasher-

* bitfinex: fix spelling

* engine/currencystate: Add logs/fix logs

Co-authored-by: Scott <[email protected]>
  • Loading branch information
shazbert and gloriousCode authored Sep 27, 2021
1 parent 1d7c656 commit 5dfbbf8
Show file tree
Hide file tree
Showing 48 changed files with 4,683 additions and 1,108 deletions.
9 changes: 5 additions & 4 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ Rots | https://github.com/Rots
vazha | https://github.com/vazha
ermalguni | https://github.com/ermalguni
MadCozBadd | https://github.com/MadCozBadd
ydm | https://github.com/ydm
vadimzhukck | https://github.com/vadimzhukck
140am | https://github.com/140am
marcofranssen | https://github.com/marcofranssen
ydm | https://github.com/ydm
lrascao | https://github.com/lrascao
dackroyd | https://github.com/dackroyd
cranktakular | https://github.com/cranktakular
woshidama323 | https://github.com/woshidama323
yangrq1018 | https://github.com/yangrq1018
crackcomm | https://github.com/crackcomm
azhang | https://github.com/azhang
andreygrehov | https://github.com/andreygrehov
bretep | https://github.com/bretep
Christian-Achilli | https://github.com/Christian-Achilli
lrascao | https://github.com/lrascao
MarkDzulko | https://github.com/MarkDzulko
yangrq1018 | https://github.com/yangrq1018
TaltaM | https://github.com/TaltaM
gam-phon | https://github.com/gam-phon
cornelk | https://github.com/cornelk
if1live | https://github.com/if1live
lozdog245 | https://github.com/lozdog245
soxipy | https://github.com/soxipy
tk42 | https://github.com/tk42
mshogin | https://github.com/mshogin
herenow | https://github.com/herenow
Expand All @@ -50,3 +50,4 @@ CodeLingoTeam | https://github.com/CodeLingoTeam
Daanikus | https://github.com/Daanikus
CodeLingoBot | https://github.com/CodeLingoBot
blombard | https://github.com/blombard
soxipy | https://github.com/soxipy
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,36 +142,36 @@ Binaries will be published once the codebase reaches a stable condition.

|User|Contribution Amount|
|--|--|
| [thrasher-](https://github.com/thrasher-) | 656 |
| [shazbert](https://github.com/shazbert) | 214 |
| [gloriousCode](https://github.com/gloriousCode) | 189 |
| [thrasher-](https://github.com/thrasher-) | 658 |
| [shazbert](https://github.com/shazbert) | 222 |
| [gloriousCode](https://github.com/gloriousCode) | 190 |
| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 88 |
| [xtda](https://github.com/xtda) | 47 |
| [dependabot[bot]](https://github.com/apps/dependabot) | 20 |
| [dependabot[bot]](https://github.com/apps/dependabot) | 22 |
| [Rots](https://github.com/Rots) | 15 |
| [vazha](https://github.com/vazha) | 15 |
| [ermalguni](https://github.com/ermalguni) | 14 |
| [MadCozBadd](https://github.com/MadCozBadd) | 13 |
| [ydm](https://github.com/ydm) | 11 |
| [vadimzhukck](https://github.com/vadimzhukck) | 10 |
| [140am](https://github.com/140am) | 8 |
| [marcofranssen](https://github.com/marcofranssen) | 8 |
| [ydm](https://github.com/ydm) | 8 |
| [lrascao](https://github.com/lrascao) | 6 |
| [dackroyd](https://github.com/dackroyd) | 5 |
| [cranktakular](https://github.com/cranktakular) | 5 |
| [woshidama323](https://github.com/woshidama323) | 3 |
| [yangrq1018](https://github.com/yangrq1018) | 3 |
| [crackcomm](https://github.com/crackcomm) | 3 |
| [azhang](https://github.com/azhang) | 2 |
| [andreygrehov](https://github.com/andreygrehov) | 2 |
| [bretep](https://github.com/bretep) | 2 |
| [Christian-Achilli](https://github.com/Christian-Achilli) | 2 |
| [lrascao](https://github.com/lrascao) | 2 |
| [MarkDzulko](https://github.com/MarkDzulko) | 2 |
| [yangrq1018](https://github.com/yangrq1018) | 2 |
| [TaltaM](https://github.com/TaltaM) | 2 |
| [gam-phon](https://github.com/gam-phon) | 2 |
| [cornelk](https://github.com/cornelk) | 2 |
| [if1live](https://github.com/if1live) | 2 |
| [lozdog245](https://github.com/lozdog245) | 2 |
| [soxipy](https://github.com/soxipy) | 2 |
| [tk42](https://github.com/tk42) | 2 |
| [mshogin](https://github.com/mshogin) | 2 |
| [herenow](https://github.com/herenow) | 2 |
Expand All @@ -192,3 +192,4 @@ Binaries will be published once the codebase reaches a stable condition.
| [Daanikus](https://github.com/Daanikus) | 1 |
| [CodeLingoBot](https://github.com/CodeLingoBot) | 1 |
| [blombard](https://github.com/blombard) | 1 |
| [soxipy](https://github.com/soxipy) | 2 |
25 changes: 25 additions & 0 deletions backtester/eventhandlers/exchange/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ func TestPlaceOrder(t *testing.T) {
t.Fatal(err)
}
exch.SetDefaults()
cfg, err := exch.GetDefaultConfig()
if err != nil {
t.Fatal(err)
}
err = exch.Setup(cfg)
if err != nil {
t.Fatal(err)
}
em.Add(exch)
bot.ExchangeManager = em
bot.OrderManager, err = engine.SetupOrderManager(em, &engine.CommunicationManager{}, &bot.ServicesWG, false)
Expand Down Expand Up @@ -191,6 +199,14 @@ func TestExecuteOrder(t *testing.T) {
t.Fatal(err)
}
exch.SetDefaults()
cfg, err := exch.GetDefaultConfig()
if err != nil {
t.Fatal(err)
}
err = exch.Setup(cfg)
if err != nil {
t.Fatal(err)
}
em.Add(exch)
bot.ExchangeManager = em
bot.OrderManager, err = engine.SetupOrderManager(em, &engine.CommunicationManager{}, &bot.ServicesWG, false)
Expand Down Expand Up @@ -287,6 +303,15 @@ func TestExecuteOrderBuySellSizeLimit(t *testing.T) {
t.Fatal(err)
}
exch.SetDefaults()
cfg, err := exch.GetDefaultConfig()
if err != nil {
t.Fatal(err)
}
err = exch.Setup(cfg)
if err != nil {
t.Fatal(err)
}

em.Add(exch)
bot.ExchangeManager = em
bot.OrderManager, err = engine.SetupOrderManager(em, &engine.CommunicationManager{}, &bot.ServicesWG, false)
Expand Down
5 changes: 5 additions & 0 deletions cmd/documentation/documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ func main() {
URL: "https://github.com/blombard",
Contributions: 1,
},
{
Login: "soxipy",
URL: "https://github.com/soxipy",
Contributions: 2,
},
}...)

if verbose {
Expand Down
14 changes: 14 additions & 0 deletions cmd/documentation/engine_templates/currency_state_manager.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{define "engine currency_state_manager" -}}
{{template "header" .}}
## Current Features for {{.CapitalName}}
+ 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.

{{template "contributions"}}
{{template "donations" .}}
{{end}}
5 changes: 5 additions & 0 deletions cmd/documentation/exchanges_templates/exchanges_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ implementation

+ A guide on implementing API support for a new exchange can be found [here](../docs/ADD_NEW_EXCHANGE.md)

## websocket notes

+ If contributing websocket improvements, please make sure order reports
follow [these rules](../docs/WS_ORDER_EVENTS.md).

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations" .}}
Expand Down
Loading

0 comments on commit 5dfbbf8

Please sign in to comment.