|
| 1 | +{{define "exchanges bitget" -}} |
| 2 | +{{template "header" .}} |
| 3 | +## Bitget Exchange |
| 4 | + |
| 5 | +### Current Features |
| 6 | + |
| 7 | ++ REST Support |
| 8 | ++ Websocket Support |
| 9 | + |
| 10 | +### How to enable |
| 11 | + |
| 12 | ++ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example) |
| 13 | + |
| 14 | ++ Individual package example below: |
| 15 | + |
| 16 | +```go |
| 17 | + // Exchanges will be abstracted out in further updates and examples will be |
| 18 | + // supplied then |
| 19 | +``` |
| 20 | + |
| 21 | +### How to do REST public/private calls |
| 22 | + |
| 23 | ++ If enabled via "configuration".json file the exchange will be added to the |
| 24 | +IBotExchange array in the ```go var bot Bot``` and you will only be able to use |
| 25 | +the wrapper interface functions for accessing exchange data. View routines.go |
| 26 | +for an example of integration usage with GoCryptoTrader. Rudimentary example |
| 27 | +below: |
| 28 | + |
| 29 | +main.go |
| 30 | +```go |
| 31 | +var b exchange.IBotExchange |
| 32 | +
|
| 33 | +for i := range bot.Exchanges { |
| 34 | + if bot.Exchanges[i].GetName() == "Bitget" { |
| 35 | + b = bot.Exchanges[i] |
| 36 | + } |
| 37 | +} |
| 38 | +
|
| 39 | +// Public calls - wrapper functions |
| 40 | +
|
| 41 | +// Fetches current ticker information |
| 42 | +tick, err := e.UpdateTicker(...) |
| 43 | +if err != nil { |
| 44 | + // Handle error |
| 45 | +} |
| 46 | +
|
| 47 | +// Fetches current orderbook information |
| 48 | +ob, err := e.UpdateOrderbook(...) |
| 49 | +if err != nil { |
| 50 | + // Handle error |
| 51 | +} |
| 52 | +
|
| 53 | +// Private calls - wrapper functions - make sure your APIKEY, APISECRET, and |
| 54 | +// CLIENTID are set and AuthenticatedAPISupport is set to true |
| 55 | +
|
| 56 | +// Fetches current account information |
| 57 | +accountInfo, err := e.GetAccountInfo() |
| 58 | +if err != nil { |
| 59 | + // Handle error |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | ++ If enabled via individually importing package, rudimentary example below: |
| 64 | + |
| 65 | +```go |
| 66 | +// Public calls |
| 67 | +
|
| 68 | +// Fetches current ticker information |
| 69 | +ticker, err := e.GetTicker() |
| 70 | +if err != nil { |
| 71 | + // Handle error |
| 72 | +} |
| 73 | +
|
| 74 | +// Fetches current orderbook information |
| 75 | +ob, err := e.GetOrderBook() |
| 76 | +if err != nil { |
| 77 | + // Handle error |
| 78 | +} |
| 79 | +
|
| 80 | +// Private calls - make sure your APIKEY, APISECRET, and CLIENTID are set |
| 81 | +// and AuthenticatedAPISupport is set to true |
| 82 | +
|
| 83 | +// GetUserInfo returns account info |
| 84 | +accountInfo, err := e.GetUserInfo(...) |
| 85 | +if err != nil { |
| 86 | + // Handle error |
| 87 | +} |
| 88 | +
|
| 89 | +// Submits an order and the exchange and returns its tradeID |
| 90 | +tradeID, err := e.Trade(...) |
| 91 | +if err != nil { |
| 92 | + // Handle error |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +### How to do Websocket public/private calls |
| 97 | + |
| 98 | +```go |
| 99 | + // Exchanges will be abstracted out in further updates and examples will be |
| 100 | + // supplied then |
| 101 | +``` |
| 102 | + |
| 103 | +{{template "donations" .}} |
| 104 | +{{end}} |
0 commit comments