kronos

package module
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 14 Imported by: 0

README

kronos

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v1.0.3

type Account struct {
	AccountId   int64
	AccountType string
	TraderId    int64
	Balance     decimal.Decimal
	Currency    string
	Opentrades  sync.Map
	Equity      decimal.Decimal
	OfficeId    int64
	Scheduler   bool
	Level       bool
	Require     decimal.Decimal
	Coeff       decimal.Decimal
	DayCoeff    decimal.Decimal
}

type ClosedPosition added in v1.0.6

type ClosedPosition struct {
	Id           int64
	PrntId       *int64
	Account      int64
	Pair         int64
	ContractSize decimal.Decimal
	OpenLots     decimal.Decimal
	CloseLots    decimal.Decimal
	OpenPrice    decimal.Decimal
	ClosePrice   decimal.Decimal
	Sellbuy      string
	Fee          decimal.Decimal
	Fee2         decimal.Decimal
	Swap         decimal.Decimal
	Swap2        decimal.Decimal
	Pl           decimal.Decimal
	Opened       time.Time
	Closed       time.Time
	Commentary   string
	PositionId   int64
}

type Message added in v1.0.5

type Message struct {
	D bool    `json:"d"`
	U []int64 `json:"u"`
	M struct {
		Event   string `json:"event"`
		Payload struct {
			A int64   `json:"a"`
			B float64 `json:"b"`
			E float64 `json:"e"`
			N float64 `json:"n"`
			P float64 `json:"p"`
			U float64 `json:"u"`
			C int64   `json:"c"`
			O []struct {
				T int64   `json:"t"`
				N float64 `json:"n"`
				P float64 `json:"p"`
			} `json:"o"`
		} `json:"payload"`
	} `json:"m"`
}

type Position

type Position struct {
	Id         int64
	Account    int64
	Pair       int64
	Amount     decimal.Decimal
	OpenPrice  decimal.Decimal
	Sellbuy    string
	Fee        decimal.Decimal
	Fee2       decimal.Decimal
	Swap       decimal.Decimal
	Swap2      decimal.Decimal
	Bonus      decimal.Decimal
	Pl         decimal.Decimal
	Opened     time.Time
	Commentary string
	PositionId int64
}

type Service

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

func NewService

func NewService(schema, dbConfig string, natsURL []string, debug bool) (*Service, error)

func (*Service) GetAccounts added in v1.0.7

func (s *Service) GetAccounts(traderFilter, accountFilter int64) (out []*Account)

func (*Service) GetClosedPositions added in v1.0.6

func (s *Service) GetClosedPositions(traderFilter int64, accountFilter, start, limit int64, from, till time.Time) (out []*ClosedPosition, err error)

func (*Service) GetPositions

func (s *Service) GetPositions(traderFilter int64) (out []*Position)

type Symbol

type Symbol struct {
	ID           int64           `json:"-"`
	Symbol       string          `json:"Symbol"`
	Market       string          `json:"Market"`
	Quote        string          `json:"Quote"`
	Desc         string          `json:"Description"`
	Active       string          `json:"Active"`
	MinTradeSize decimal.Decimal `json:"MinTradeSize"`
	Precision    decimal.Decimal `json:"Precision"`
	ContractSize decimal.Decimal `json:"ContractSize"`
	Group        string          `json:"Group"`
	Type         string          `json:"Type"`
	Bid          decimal.Decimal `json:"Sell"`
	Ask          decimal.Decimal `json:"Buy"`
	Date         time.Time       `json:"PriceDate"`
}

Jump to

Keyboard shortcuts

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