Documentation ¶
Index ¶
- Variables
- type APIKey
- type AuthCache
- func (cache *AuthCache) GetUserDefaultKey(loginAuth context.Context) *APIKey
- func (cache *AuthCache) HasDefaultAuth() bool
- func (cache *AuthCache) HasSavedAuth(baseHost string) bool
- func (cache *AuthCache) Login(identity string, password *Password) context.Context
- func (cache *AuthCache) NextAuth(parent context.Context) context.Context
- func (cache *AuthCache) SetConfigFile(path string)
- func (cache *AuthCache) SetLoginInfo(host, identity string, password *Password)
- func (cache *AuthCache) WriteConfig() error
- type Authentication
- type ClientHub
- type FlagTime
- type IdentityMap
- type JavaTime
- type Order
- type OrderCache
- func (cache *OrderCache) CloseInputs()
- func (cache *OrderCache) CloseResults()
- func (cache *OrderCache) GetInputs() <-chan *Order
- func (cache *OrderCache) GetResults() <-chan *Order
- func (cache *OrderCache) PutOrder(id string, ord *Order, timeout time.Duration) error
- func (cache *OrderCache) PutResult(ord *ngerest.Order)
- type OrderSide
- func (s *OrderSide) MarshalCSV() string
- func (s *OrderSide) MarshalJSON() ([]byte, error)
- func (s *OrderSide) MatchSide(qty int64) error
- func (s *OrderSide) Opposite() OrderSide
- func (s *OrderSide) Set(value string) error
- func (s *OrderSide) String() string
- func (s *OrderSide) Type() string
- func (s *OrderSide) UnmarshalCSV(value string) error
- func (s *OrderSide) UnmarshalJSON(data []byte) error
- func (s *OrderSide) Value() int64
- type Password
- func (p *Password) IsSet() bool
- func (p *Password) MarshalCSV() string
- func (p *Password) MarshalJSON() ([]byte, error)
- func (p *Password) Set(value string) error
- func (p *Password) Shadow(value string) string
- func (p *Password) ShadowSet(value string) (err error)
- func (p *Password) Show() string
- func (p *Password) String() string
- func (p *Password) Type() string
- func (p *Password) UnmarshalCSV(value string) error
- func (p *Password) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var EmptyTime = genEmptyTime()
EmptyTime 0001-01-01 00:00:00
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct { Key string `csv:"api_key" json:"api_key"` Secret string `csv:"api_secret" json:"api_secret"` }
APIKey key & secret for api
type AuthCache ¶
type AuthCache struct { CmdAuthFile string DefaultID string DefaultPass Password // contains filtered or unexported fields }
AuthCache api auth cache
func NewAuthCache ¶
NewAuthCache create new api auth cache
func (*AuthCache) GetUserDefaultKey ¶
GetUserDefaultKey get user's default sys api key
func (*AuthCache) HasDefaultAuth ¶
HasDefaultAuth to judge if auth info is exist from cmd args
func (*AuthCache) HasSavedAuth ¶
HasSavedAuth to judge if auth info is already saved in auth.yaml
func (*AuthCache) SetConfigFile ¶
SetConfigFile set auth config file path
func (*AuthCache) SetLoginInfo ¶
SetLoginInfo save host's login info in viper config
func (*AuthCache) WriteConfig ¶
WriteConfig write login info to auth config file
type Authentication ¶
type Authentication struct { Identity string `csv:"identity" json:"identity"` Password Password `csv:"password" json:"password"` APIKey }
Authentication auth info including: 1. identity 2. Password instance 3. embedded APIKey struct
func (*Authentication) Validate ¶
func (auth *Authentication) Validate() bool
Validate completion of auth info
type ClientHub ¶
type ClientHub struct {
// contains filtered or unexported fields
}
ClientHub is a hub of clients from hosts
type IdentityMap ¶
IdentityMap identity pattern map
func NewIdentityMap ¶
func NewIdentityMap() IdentityMap
NewIdentityMap generate identity pattern map
func (*IdentityMap) AddPattern ¶
func (idMap *IdentityMap) AddPattern( name string, pattern *regexp.Regexp) error
AddPattern add new pattern to IdentityMap
func (*IdentityMap) CheckIdentity ¶
func (idMap *IdentityMap) CheckIdentity( id string, login map[string]string) error
CheckIdentity check & modify login map
type JavaTime ¶
type JavaTime int64
JavaTime java timestamp format
func (JavaTime) MarshalCSV ¶
MarshalCSV marshal java time to csv string.
func (JavaTime) UnmarshalCSV ¶
UnmarshalCSV unmarshal csv string to java time
type Order ¶
type Order struct { OrderID string `csv:"orderID" json:"orderID"` ClOrdID string `csv:"clOrdID,omitempty" json:"clOrdID,omitempty"` ClOrdLinkID string `csv:"clOrdLinkID,omitempty" json:"clOrdLinkID,omitempty"` Account float32 `csv:"account,omitempty" json:"account,omitempty"` Symbol string `csv:"symbol,omitempty" json:"symbol,omitempty"` Side OrderSide `csv:"side,omitempty" json:"side,omitempty"` SimpleOrderQty float64 `csv:"simpleOrderQty,omitempty" json:"simpleOrderQty,omitempty"` OrderQty float32 `csv:"orderQty,omitempty" json:"orderQty,omitempty"` Price float64 `csv:"price,omitempty" json:"price,omitempty"` DisplayQty float32 `csv:"displayQty,omitempty" json:"displayQty,omitempty"` StopPx float64 `csv:"stopPx,omitempty" json:"stopPx,omitempty"` PegOffsetValue float64 `csv:"pegOffsetValue,omitempty" json:"pegOffsetValue,omitempty"` PegPriceType string `csv:"pegPriceType,omitempty" json:"pegPriceType,omitempty"` Currency string `csv:"currency,omitempty" json:"currency,omitempty"` SettlCurrency string `csv:"settlCurrency,omitempty" json:"settlCurrency,omitempty"` OrdType string `csv:"ordType,omitempty" json:"ordType,omitempty"` TimeInForce string `csv:"timeInForce,omitempty" json:"timeInForce,omitempty"` ExecInst string `csv:"execInst,omitempty" json:"execInst,omitempty"` ContingencyType string `csv:"contingencyType,omitempty" json:"contingencyType,omitempty"` ExDestination string `csv:"exDestination,omitempty" json:"exDestination,omitempty"` OrdStatus string `csv:"ordStatus,omitempty" json:"ordStatus,omitempty"` Triggered string `csv:"triggered,omitempty" json:"triggered,omitempty"` WorkingIndicator bool `csv:"workingIndicator,omitempty" json:"workingIndicator,omitempty"` OrdRejReason string `csv:"ordRejReason,omitempty" json:"ordRejReason,omitempty"` SimpleLeavesQty float64 `csv:"simpleLeavesQty,omitempty" json:"simpleLeavesQty,omitempty"` LeavesQty float32 `csv:"leavesQty,omitempty" json:"leavesQty,omitempty"` SimpleCumQty float64 `csv:"simpleCumQty,omitempty" json:"simpleCumQty,omitempty"` CumQty float32 `csv:"cumQty,omitempty" json:"cumQty,omitempty"` AvgPx float64 `csv:"avgPx,omitempty" json:"avgPx,omitempty"` MultiLegReportingType string `csv:"multiLegReportingType,omitempty" json:"multiLegReportingType,omitempty"` Text string `csv:"text,omitempty" json:"text,omitempty"` TransactTime JavaTime `csv:"transactTime,omitempty" json:"transactTime,omitempty"` Timestamp JavaTime `csv:"timestamp,omitempty" json:"timestamp,omitempty"` }
Order order table
func ConvertOrder ¶
ConvertOrder convert ngerest.Order structure to local Order structure
type OrderCache ¶
type OrderCache struct {
// contains filtered or unexported fields
}
OrderCache is a order input & output channel
func (*OrderCache) CloseInputs ¶
func (cache *OrderCache) CloseInputs()
CloseInputs to close order cache's input channel
func (*OrderCache) CloseResults ¶
func (cache *OrderCache) CloseResults()
CloseResults to close order results channel
func (*OrderCache) GetInputs ¶
func (cache *OrderCache) GetInputs() <-chan *Order
GetInputs to get order cache's input channel
func (*OrderCache) GetResults ¶
func (cache *OrderCache) GetResults() <-chan *Order
GetResults to get order results channl
func (*OrderCache) PutResult ¶
func (cache *OrderCache) PutResult(ord *ngerest.Order)
PutResult puts order result into cache
type OrderSide ¶
type OrderSide string
OrderSide order side
func (*OrderSide) MarshalCSV ¶
MarshalCSV marshal to csv column
func (*OrderSide) MarshalJSON ¶
MarshalJSON marshal to json string
func (*OrderSide) UnmarshalCSV ¶
UnmarshalCSV unmarshal csv column to OrderSide
func (*OrderSide) UnmarshalJSON ¶
UnmarshalJSON unmarshal from json string
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
Password shadowed password store
func NewPasswordByPEM ¶
NewPasswordByPEM create password with user specified pem key, if pemPath not specified or is invalid, will return Password with default key
func (*Password) MarshalCSV ¶
MarshalCSV marshal password to csv
func (*Password) MarshalJSON ¶
MarshalJSON marshal to json string
func (*Password) UnmarshalCSV ¶
UnmarshalCSV unmarshal password from csv
func (*Password) UnmarshalJSON ¶
UnmarshalJSON unmarshal from json string