ddf

package
v0.0.0-...-72a37b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2019 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Go ddfplus API

Copyright 2019 Barchart.com, Inc. All rights reserved.

This Source Code Form is subject to the terms of the GNU license available at https://github.com/barchart/go-ddfplus-api/blob/master/LICENSE.

Index

Constants

View Source
const (
	JerqVersion = 4
)
View Source
const UserSettingsURL = "http://www.ddfplus.com/json/usersettings/"

Variables

This section is empty.

Functions

func ParseFloat

func ParseFloat(s string, bc string) (float64, error)

func ParseTimestamp

func ParseTimestamp(ba []byte, etxpos int) (time.Time, error)

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(credentials *Credentials) (*Connection, error)

func (*Connection) RegisterMarketUpdate

func (c *Connection) RegisterMarketUpdate(symbols []string, ch chan Message)

func (*Connection) RegisterMarketUpdateAll

func (c *Connection) RegisterMarketUpdateAll(ch chan Message)

func (*Connection) RegisterTimestamp

func (c *Connection) RegisterTimestamp(ch chan MessageTimestamp)

func (*Connection) Server

func (c *Connection) Server()

func (*Connection) Start

func (c *Connection) Start()

type Credentials

type Credentials struct {
	Username string
	Password string
}

type DB

type DB struct {
	// contains filtered or unexported fields
}

func InitDB

func InitDB() *DB

func (*DB) Connect

func (db *DB) Connect(conn *Connection)

func (DB) GetQuote

func (db DB) GetQuote(symbol string) *Quote

func (*DB) Process

func (db *DB) Process(m Message) error

func (*DB) Register

func (db *DB) Register(symbols []string, ch chan *Quote)

func (*DB) Timestamp

func (db *DB) Timestamp() time.Time

type DDFMessageInfo

type DDFMessageInfo struct {
	BaseCode  string
	Exchange  string
	Delay     int
	Record    byte
	Subrecord byte
	DayCode   byte
	Session   byte
}

type Message

type Message interface {
	Type() MessageType
}

func Parse

func Parse(ba []byte) (Message, error)

type MessageBidAsk

type MessageBidAsk struct {
	Symbol    string
	Info      DDFMessageInfo
	Bid       float64
	BidSize   int64
	Ask       float64
	AskSize   int64
	Timestamp time.Time
}

func (MessageBidAsk) Type

func (m MessageBidAsk) Type() MessageType

type MessageRefresh

type MessageRefresh struct {
	Symbol         string
	Name           string
	Exchange       string
	BaseCode       string
	PointValue     float64
	TickIncrement  int
	DDFExchange    string
	LastUpdate     time.Time
	Bid            float64
	BidSize        int64
	Ask            float64
	AskSize        int64
	CurrentSession struct {
		Day          string
		Session      string
		Timestamp    time.Time
		Open         float64
		High         float64
		Low          float64
		Last         float64
		Previous     float64
		Settlement   float64
		TradeSize    int64
		Volume       int64
		OpenInterest int64
		NumTrades    int64
		PriceVolume  float64
		TradeTime    time.Time
		Ticks        string
	}
	PreviousSession struct {
		Day          string
		Session      string
		Timestamp    time.Time
		Open         float64
		High         float64
		Low          float64
		Last         float64
		Previous     float64
		Settlement   float64
		TradeSize    int64
		Volume       int64
		OpenInterest int64
		NumTrades    int64
		PriceVolume  float64
		TradeTime    time.Time
		Ticks        string
	}
}

func (MessageRefresh) Type

func (m MessageRefresh) Type() MessageType

type MessageTimestamp

type MessageTimestamp struct {
	Timestamp time.Time
}

func (MessageTimestamp) Type

func (m MessageTimestamp) Type() MessageType

type MessageTrade

type MessageTrade struct {
	Symbol    string
	Info      DDFMessageInfo
	Trade     float64
	TradeSize int64
	Timestamp time.Time
}

func (MessageTrade) Type

func (m MessageTrade) Type() MessageType

type MessageType

type MessageType int
const (
	BidAsk MessageType = iota
	Refresh
	Timestamp
	Trade
)

type Quote

type Quote struct {
	Symbol string `json:"symbol"`
	Info   struct {
		Name          string  `json:"name"`
		Exchange      string  `json:"exchange"`
		DDFExchange   string  `json:"ddfexchange"`
		BaseCode      string  `json:"basecode"`
		TickIncrement int     `json:"tickincrement"`
		PointValue    float64 `json:"pointvalue"`
	} `json:":info"`
	Data struct {
		CurrentSession struct {
			Bid       float64   `json:"bid"`
			BidSize   int64     `json:"bidsize"`
			Ask       float64   `json:"ask"`
			AskSize   int64     `json:"asksize"`
			Open      float64   `json:"open"`
			High      float64   `json:"high"`
			Low       float64   `json:"low"`
			Last      float64   `json:"last"`
			LastSize  int64     `json:"lastsize"`
			TradeTime time.Time `json:"tradetime"`
			Timestamp time.Time `json:timestamp"`
		} `json:"current"`
	} `json:"data"`
	LastUpdate time.Time `json:"lastupdate"`
}

type Symbol

type Symbol struct {
	Type    SymbolType
	Root    string
	Month   string
	Year    int
	Strike  int
	CallPut string
}

func ParseSymbol

func ParseSymbol(s string) (Symbol, error)

type SymbolType

type SymbolType int
const (
	Unknown      SymbolType = 0
	Future       SymbolType = 1
	FutureOption SymbolType = 2
)

type UserSettings

type UserSettings struct {
	Login struct {
		Username    string `json:"username"`
		Status      bool   `json:"status"`
		Credentials bool   `json:"credentials"`
	} `json:"login"`
	Service struct {
		Id         string `json:"id"`
		MaxSymbols int    `json:"maxsymbols"`
	} `json:"service"`
	Exchanges []string `json:"exchanges"`
	Servers   struct {
		Stream     []string `json:"stream"`
		WSS        []string `json:"wss"`
		Historical []string `json:"historical"`
		Extras     []string `json:"extras"`
		News       []string `json:"news"`
	} `json:"servers"`
}

func GetUserSettings

func GetUserSettings(credentials *Credentials) (UserSettings, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL