mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 23:16:52 +00:00
Fixed merge issues, fixed race condition in gemini package.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
@@ -71,10 +72,13 @@ var (
|
||||
// needed append the sandbox function as well.
|
||||
type Gemini struct {
|
||||
exchange.Base
|
||||
M sync.Mutex
|
||||
}
|
||||
|
||||
// AddSession adds a new session to the gemini base
|
||||
func (g *Gemini) AddSession(sessionID int, apiKey, apiSecret, role string, needsHeartbeat bool) error {
|
||||
g.M.Lock()
|
||||
defer g.M.Unlock()
|
||||
if sessionAPIKey == nil {
|
||||
IsSession = true
|
||||
sessionAPIKey = make(map[int]string)
|
||||
@@ -139,6 +143,8 @@ func (g *Gemini) Setup(exch config.ExchangeConfig) {
|
||||
// Session is a session manager for differing APIKeys and roles, use this for all function
|
||||
// calls in this package
|
||||
func (g *Gemini) Session(sessionID int) *Gemini {
|
||||
g.M.Lock()
|
||||
defer g.M.Unlock()
|
||||
g.APIUrl = geminiAPIURL
|
||||
_, ok := sessionAPIKey[sessionID]
|
||||
if !ok {
|
||||
|
||||
@@ -94,7 +94,7 @@ func (w *WEX) GetFee() float64 {
|
||||
func (w *WEX) GetInfo() (Info, error) {
|
||||
req := fmt.Sprintf("%s/%s/%s/", wexAPIPublicURL, wexAPIPublicVersion, wexInfo)
|
||||
resp := Info{}
|
||||
err := common.SendHTTPGetRequest(req, true, &resp)
|
||||
err := common.SendHTTPGetRequest(req, true, w.Verbose, &resp)
|
||||
|
||||
if err != nil {
|
||||
return resp, err
|
||||
@@ -111,7 +111,7 @@ func (w *WEX) GetTicker(symbol string) (map[string]Ticker, error) {
|
||||
|
||||
response := Response{}
|
||||
req := fmt.Sprintf("%s/%s/%s/%s", wexAPIPublicURL, wexAPIPublicVersion, wexTicker, symbol)
|
||||
err := common.SendHTTPGetRequest(req, true, &response.Data)
|
||||
err := common.SendHTTPGetRequest(req, true, w.Verbose, &response.Data)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -128,7 +128,7 @@ func (w *WEX) GetDepth(symbol string) (Orderbook, error) {
|
||||
response := Response{}
|
||||
req := fmt.Sprintf("%s/%s/%s/%s", wexAPIPublicURL, wexAPIPublicVersion, wexDepth, symbol)
|
||||
|
||||
err := common.SendHTTPGetRequest(req, true, &response.Data)
|
||||
err := common.SendHTTPGetRequest(req, true, w.Verbose, &response.Data)
|
||||
if err != nil {
|
||||
return Orderbook{}, err
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func (w *WEX) GetTrades(symbol string) ([]Trades, error) {
|
||||
response := Response{}
|
||||
req := fmt.Sprintf("%s/%s/%s/%s", wexAPIPublicURL, wexAPIPublicVersion, wexTrades, symbol)
|
||||
|
||||
err := common.SendHTTPGetRequest(req, true, &response.Data)
|
||||
err := common.SendHTTPGetRequest(req, true, w.Verbose, &response.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user