Skip to content

Commit

Permalink
Release: v1.0.19-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-the-h committed Oct 3, 2021
1 parent 95b23b3 commit 5dad581
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 184 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ Changelog
=========
All notable changes to this project will be documented in this file.

v1.0.19-alpha
------------

### Changed

- Fixed trade models json tags

v1.0.18-alpha
------------

Expand Down
7 changes: 0 additions & 7 deletions api/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func NewClient(apiKey, secretKey, passphrase string, baseURL okex.BaseURL, desti
c.Market = NewMarket(c)
c.PublicData = NewPublicData(c)
c.TradeData = NewTradeData(c)

return c
}

Expand Down Expand Up @@ -91,10 +90,8 @@ func (c *ClientRest) Do(method, path string, private bool, params ...map[string]
if err != nil {
return nil, err
}

r.Header.Add("Content-Type", "application/json")
}

if err != nil {
return nil, err
}
Expand All @@ -108,7 +105,6 @@ func (c *ClientRest) Do(method, path string, private bool, params ...map[string]
if c.destination == okex.DemoServer {
r.Header.Add("x-simulated-trading", "1")
}

return c.client.Do(r)
}

Expand All @@ -126,7 +122,6 @@ func (c *ClientRest) Status(req requests.Status) (response responses.Status, err
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -138,7 +133,5 @@ func (c *ClientRest) sign(method, path, body string) (string, string) {
p := []byte(s)
h := hmac.New(sha256.New, c.secretKey)
h.Write(p)

// Get result and encode as hexadecimal string
return ts, base64.StdEncoding.EncodeToString(h.Sum(nil))
}
27 changes: 0 additions & 27 deletions api/rest/funding.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ func (c *Funding) GetBalance(req requests.GetBalance) (response responses.GetBal
if len(req.Ccy) > 0 {
m["ccy"] = strings.Join(req.Ccy, ",")
}

res, err := c.client.Do(http.MethodGet, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -70,16 +67,13 @@ func (c *Funding) GetBalance(req requests.GetBalance) (response responses.GetBal
func (c *Funding) FundsTransfer(req requests.FundsTransfer) (response responses.FundsTransfer, err error) {
p := "/api/v5/asset/transfer"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodPost, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -90,16 +84,13 @@ func (c *Funding) FundsTransfer(req requests.FundsTransfer) (response responses.
func (c *Funding) AssetBillsDetails(req requests.AssetBillsDetails) (response responses.AssetBillsDetails, err error) {
p := "/api/v5/asset/bills"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodGet, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -110,16 +101,13 @@ func (c *Funding) AssetBillsDetails(req requests.AssetBillsDetails) (response re
func (c *Funding) GetDepositAddress(req requests.GetDepositAddress) (response responses.GetDepositAddress, err error) {
p := "/api/v5/asset/deposit-address"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodGet, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -130,16 +118,13 @@ func (c *Funding) GetDepositAddress(req requests.GetDepositAddress) (response re
func (c *Funding) GetDepositHistory(req requests.GetDepositHistory) (response responses.GetDepositHistory, err error) {
p := "/api/v5/asset/deposit-history"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodGet, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -150,16 +135,13 @@ func (c *Funding) GetDepositHistory(req requests.GetDepositHistory) (response re
func (c *Funding) Withdrawal(req requests.Withdrawal) (response responses.Withdrawal, err error) {
p := "/api/v5/asset/withdrawal"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodPost, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -170,16 +152,13 @@ func (c *Funding) Withdrawal(req requests.Withdrawal) (response responses.Withdr
func (c *Funding) GetWithdrawalHistory(req requests.GetWithdrawalHistory) (response responses.GetWithdrawalHistory, err error) {
p := "/api/v5/asset/withdrawal-history"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodGet, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -189,16 +168,13 @@ func (c *Funding) GetWithdrawalHistory(req requests.GetWithdrawalHistory) (respo
func (c *Funding) PiggyBankPurchaseRedemption(req requests.PiggyBankPurchaseRedemption) (response responses.PiggyBankPurchaseRedemption, err error) {
p := "/api/v5/asset/purchase_redempt"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodPost, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -208,15 +184,12 @@ func (c *Funding) PiggyBankPurchaseRedemption(req requests.PiggyBankPurchaseRede
func (c *Funding) GetPiggyBankBalance(req requests.GetPiggyBankBalance) (response responses.GetPiggyBankBalance, err error) {
p := "/api/v5/asset/piggy-balance"
m := okex.S2M(req)

res, err := c.client.Do(http.MethodGet, p, true, m)
if err != nil {
return
}
defer res.Body.Close()

d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}
11 changes: 0 additions & 11 deletions api/rest/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func (c *Market) GetTickers(req requests.GetTickers) (response responses.Ticker,
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -52,7 +51,6 @@ func (c *Market) GetTicker(req requests.GetTickers) (response responses.Ticker,
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -70,7 +68,6 @@ func (c *Market) GetIndexTickers(req requests.GetIndexTickers) (response respons
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -88,7 +85,6 @@ func (c *Market) GetOrderBook(req requests.GetOrderBook) (response responses.Ord
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -106,7 +102,6 @@ func (c *Market) GetCandlesticks(req requests.GetCandlesticks) (response respons
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -124,7 +119,6 @@ func (c *Market) GetCandlesticksHistory(req requests.GetCandlesticks) (response
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -142,7 +136,6 @@ func (c *Market) GetIndexCandlesticks(req requests.GetCandlesticks) (response re
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -160,7 +153,6 @@ func (c *Market) GetMarkPriceCandlesticks(req requests.GetCandlesticks) (respons
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -178,7 +170,6 @@ func (c *Market) GetTrades(req requests.GetTrades) (response responses.Trade, er
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -195,7 +186,6 @@ func (c *Market) Get24HTotalVolume() (response responses.TotalVolume24H, err err
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -213,6 +203,5 @@ func (c *Market) GetIndexComponents(req requests.GetIndexComponents) (response r
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}
13 changes: 0 additions & 13 deletions api/rest/public_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func (c *PublicData) GetInstruments(req requests.GetInstruments) (response respo
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -52,7 +51,6 @@ func (c *PublicData) GetDeliveryExerciseHistory(req requests.GetDeliveryExercise
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -70,7 +68,6 @@ func (c *PublicData) GetOpenInterest(req requests.GetOpenInterest) (response res
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -88,7 +85,6 @@ func (c *PublicData) GetLimitPrice(req requests.GetLimitPrice) (response respons
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -106,7 +102,6 @@ func (c *PublicData) GetOptionMarketData(req requests.GetOptionMarketData) (resp
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -124,7 +119,6 @@ func (c *PublicData) GetEstimatedDeliveryExercisePrice(req requests.GetEstimated
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -142,7 +136,6 @@ func (c *PublicData) GetDiscountRateAndInterestFreeQuota(req requests.GetDiscoun
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -159,7 +152,6 @@ func (c *PublicData) GetSystemTime() (response responses.GetSystemTime, err erro
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -177,7 +169,6 @@ func (c *PublicData) GetLiquidationOrders(req requests.GetLiquidationOrders) (re
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -197,7 +188,6 @@ func (c *PublicData) GetMarkPrice(req requests.GetMarkPrice) (response responses
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -215,7 +205,6 @@ func (c *PublicData) GetPositionTiers(req requests.GetPositionTiers) (response r
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -232,7 +221,6 @@ func (c *PublicData) GetInterestRateAndLoanQuota() (response responses.GetIntere
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

Expand All @@ -249,6 +237,5 @@ func (c *PublicData) GetUnderlying(req requests.GetUnderlying) (response respons
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}
Loading

0 comments on commit 5dad581

Please sign in to comment.