123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package request
- import (
- "bytes"
- "encoding/xml"
- "time"
- )
- func (this *TopOfBookHistoricMarketDataRequest) Url() string {
- return "/secure/read/marketData/requestHistoricMarketData"
- }
- type TopOfBookHistoricMarketDataRequest struct {
- XMLName xml.Name `xml:"req" json:"-"`
- InstructionId string `xml:"body>instructionId" json:"instructionId"`
- InstrumentId int64 `xml:"body>orderBookId" json:"instrumentId"`
- From int64 `xml:"body>from" json:"from"`
- To int64 `xml:"body>to" json:"to"`
- Option []string `xml:"body>orderBook>options>option" json:"option"`
- Depth int32 `xml:"body>orderBook>depth" json:"depth"`
- Format string `xml:"body>orderBook>format" json:"format"`
- }
- func (this *TopOfBookHistoricMarketDataRequest) GetRequestData() *bytes.Buffer {
- data, _ := xml.Marshal(this)
- return bytes.NewBuffer(data)
- }
- func NewTopOfBookHistoricRequest(instructionId string, instrumentId int64,
- from time.Time, to time.Time, format string) *TopOfBookHistoricMarketDataRequest {
- return &TopOfBookHistoricMarketDataRequest{
- InstructionId: instructionId,
- InstrumentId: instrumentId, From: from.Unix() * 1000, To: to.Unix() * 1000,
- Option: []string{"BID", "ASK"}, Depth: 1,
- Format: format}
- }
- type AggregateHistoricMarketDataRequest struct {
- XMLName xml.Name `xml:"req" json:"-"`
- InstructionId string `xml:"body>instructionId" json:"instructionId"`
- InstrumentId int64 `xml:"body>orderBookId" json:"instrumentId"`
- From int64 `xml:"body>from" json:"from"`
- To int64 `xml:"body>to" json:"to"`
- Option []string `xml:"body>aggregate>options>option" json:"option"`
- Resolution string `xml:"body>aggregate>resolution" json:"resolution"`
- Depth int `xml:"body>aggregate>depth" json:"depth"`
- Format string `xml:"body>aggregate>format" json:"format"`
- }
- func (this *AggregateHistoricMarketDataRequest) Url() string {
- return "/secure/read/marketData/requestHistoricMarketData"
- }
- func (this *AggregateHistoricMarketDataRequest) GetRequestData() *bytes.Buffer {
- output, _ := xml.Marshal(this)
- return bytes.NewBuffer(output)
- }
- func NewAggregateHistoricRequest(instructionId string, instrumentId int64, from time.Time, to time.Time,
- format string, resolution string, option []string) *AggregateHistoricMarketDataRequest {
- return &AggregateHistoricMarketDataRequest{
- InstructionId: instructionId,
- InstrumentId: instrumentId,
- From: from.Unix() * 1000, To: to.Unix() * 1000, Format: format,
- Resolution: resolution, Option: option, Depth: 1}
- }
|