This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func Setup() *Engine { | |
| engerino := new(Engine) | |
| engerino.Config = &config.Cfg | |
| err := engerino.Config.LoadConfig(config.TestFile, true) | |
| if err != nil { | |
| } | |
| exch := engerino.GetExchangeByName(testExchange) | |
| if exch == nil { | |
| err = engerino.LoadExchange(testExchange, false, nil) | |
| if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // uses existing sqlite db in .gocryptotrader/database directory | |
| func TestCandleSaving(t *testing.T) { | |
| var err error | |
| Bot, err = New() | |
| if err != nil { | |
| t.Fatalf("Failed to initialise engine. Err: %s", err) | |
| } | |
| Bot.Settings = Settings{ | |
| DisableExchangeAutoPairUpdates: true, | |
| EnableExchangeHTTPRateLimiter: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func TestTheThing1(t *testing.T) { | |
| var err error | |
| Bot, err = New() | |
| if err != nil { | |
| t.Fatalf("Failed to initialise engine. Err: %s", err) | |
| } | |
| Bot.Settings = Settings{ | |
| DisableExchangeAutoPairUpdates: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // AddSubscription appends a successful subscription | |
| func (w *Websocket) AddSubscription(cs ...ChannelSubscription) { | |
| w.subscriptions = append(w.subscriptions, cs...) | |
| } | |
| // Demos how it can be handled when only one request sent | |
| func (b *Bitmex) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error { | |
| var subscriber WebsocketRequest | |
| subscriber.Command = "subscribe" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // the following response is in this loop 9 times: | |
| // { "Timestamp": "2020-07-01T04:42:24.982288Z", "TID": "57923392", "Price": 0.08329, "Amount": 1000, "Exchange": "FTX", "Type": "", "Side": "buy", "Fee": 0, "Description": "" } | |
| // raw response: | |
| [ [ { "Timestamp": "2020-07-01T04:43:26.086596Z", "TID": "57923864", "Price": 0.08329, "Amount": 1, "Exchange": "FTX", "Type": "", "Side": "buy", "Fee": 0, "Description": "" }, { "Timestamp": "2020-07-01T04:43:23.500016Z", "TID": "57923852", "Price": 0.08329, "Amount": 1, "Exchange": "FTX", "Type": "", "Side": "buy", "Fee": 0, "Description": "" }, { "Timestamp": "2020-07-01T04:43:21.470694Z", "TID": "57923846", "Price": 0.08329, "Amount": 2, "Exchange": "FTX", "Type": "", "Side": "buy", "Fee": 0, "Description": "" }, { "Timestamp": "2020-07-01T04:43:19.449064Z", "TID": "57923842", "Price": 0.08329, "Amount": 4, "Exchange": "FTX", "Type": "", "Side": "buy", "Fee": 0, "Description": "" }, { "Timestamp": "2020-07-01T04:43:17.342063Z", "TID": "57923825", "Price": 0.0832 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
| func randSeq(n int) string { | |
| b := make([]rune, n) | |
| for i := range b { | |
| b[i] = letters[rand.Intn(len(letters))] | |
| } | |
| return string(b) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module main | |
| go 1.14 | |
| replace github.com/thrasher-corp/gocryptotrader => ./../../gocryptotrader | |
| require github.com/thrasher-corp/gocryptotrader v0.0.0-00010101000000-000000000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func TestWsDepthUpdate(t *testing.T) { | |
| seedLastUpdateID := int64(161) | |
| book := OrderBook{ | |
| Asks: []OrderbookItem{ | |
| {Price: 6621.80000000, Quantity: 0.00198100}, | |
| {Price: 6622.14000000, Quantity: 4.00000000}, | |
| {Price: 6622.46000000, Quantity: 2.30000000}, | |
| {Price: 6622.47000000, Quantity: 1.18633300}, | |
| {Price: 6622.64000000, Quantity: 4.00000000}, | |
| {Price: 6622.73000000, Quantity: 0.02900000}, |
NewerOlder