Skip to content

Commit

Permalink
Release: v1.0.15-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-the-h committed Oct 1, 2021
1 parent d507e2e commit 7579534
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 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.15-alpha
------------

### Changed

- Added status endpoint on rest

v1.0.14-alpha
------------

Expand Down
20 changes: 20 additions & 0 deletions api/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"encoding/json"
"fmt"
"github.com/amir-the-h/okex"
requests "github.com/amir-the-h/okex/requests/rest/public"
responses "github.com/amir-the-h/okex/responses/public_data"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -110,6 +112,24 @@ func (c *ClientRest) Do(method, path string, private bool, params ...map[string]
return c.client.Do(r)
}

// Status
// Get event status of system upgrade
//
// https://www.okex.com/docs-v5/en/#rest-api-status
func (c *ClientRest) Status(req requests.Status) (response responses.Status, err error) {
p := "/api/v5/system/status"
m := okex.S2M(req)
res, err := c.Do(http.MethodGet, p, false, m)
if err != nil {
return
}
defer res.Body.Close()
d := json.NewDecoder(res.Body)
err = d.Decode(&response)

return
}

func (c *ClientRest) sign(method, path, body string) (string, string) {
format := "2006-01-02T15:04:05.999Z07:00"
t := time.Now().UTC().Format(format)
Expand Down
10 changes: 10 additions & 0 deletions models/publicdata/publicdata_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,14 @@ type (
IrDiscount okex.JSONFloat64 `json:"irDiscount"`
LoanQuotaCoef int `json:"loanQuotaCoef,string"`
}
State struct {
Title string `json:"title"`
State string `json:"state"`
Href string `json:"href"`
ServiceType string `json:"serviceType"`
System string `json:"system"`
ScheDesc string `json:"scheDesc"`
Begin okex.JSONTime `json:"begin"`
End okex.JSONTime `json:"end"`
}
)
3 changes: 3 additions & 0 deletions requests/rest/public/public_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ type (
GetUnderlying struct {
InstType okex.InstrumentType `json:"instType,string"`
}
Status struct {
State string `json:"state,omitempty"`
}
)
4 changes: 4 additions & 0 deletions responses/public_data/public_data_responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ type (
responses.Basic
Underlings [][]string `json:"data,omitempty"`
}
Status struct {
responses.Basic
States []publicdata.State `json:"data,omitempty"`
}
)

0 comments on commit 7579534

Please sign in to comment.