Documentation ¶
Index ¶
- Variables
- type CancelOrderRequest
- type ComparisonOperator
- type Contract
- type ExchangeType
- type ExitPosition
- type HoldPosition
- type MarginOrder
- type MarginOrderRequest
- type MarginPosition
- type OrderResult
- type OrderStatus
- type OrderSummary
- type PriceKind
- type RegisterPriceRequest
- type Session
- type Side
- type StockExecutionCondition
- func (e StockExecutionCondition) IsContractableAfternoonSession() bool
- func (e StockExecutionCondition) IsContractableAfternoonSessionClosing() bool
- func (e StockExecutionCondition) IsContractableMorningSession() bool
- func (e StockExecutionCondition) IsContractableMorningSessionClosing() bool
- func (e StockExecutionCondition) IsFunari() bool
- func (e StockExecutionCondition) IsLimitOrder() bool
- func (e StockExecutionCondition) IsMarketOrder() bool
- func (e StockExecutionCondition) IsStop() bool
- type StockOrder
- type StockOrderRequest
- type StockPosition
- type StockStopCondition
- type TradeType
- type UpdatedOrders
- type VirtualSecurity
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NilArgumentError = errors.New("nil argument error") NoDataError = errors.New("no data error") ExpiredDataError = errors.New("expired data error") NotEnoughOwnedQuantityError = errors.New("not enough owned quantity error") NotEnoughHoldQuantityError = errors.New("not enough hold quantity error") UncancellableOrderError = errors.New("uncancellable order error") InvalidSideError = errors.New("invalid side error") InvalidExecutionConditionError = errors.New("invalid execution condition error") InvalidSymbolCodeError = errors.New("invalid symbol code error") InvalidQuantityError = errors.New("invalid quantity error") InvalidLimitPriceError = errors.New("invalid limit price error") InvalidExpiredError = errors.New("invalid expired error") InvalidStopConditionError = errors.New("invalid stop condition error") InvalidTimeError = errors.New("invalid time error") InvalidExchangeTypeError = errors.New("invalid exchange error") InvalidTradeTypeError = errors.New("invalid trade type error") InvalidExitPositionError = errors.New("invalid exit position error") InvalidExitQuantityError = errors.New("invalid exit quantity error") InvalidExitPositionCodeError = errors.New("invalid exit position code error") )
Functions ¶
This section is empty.
Types ¶
type CancelOrderRequest ¶
type CancelOrderRequest struct {
OrderCode string // 取消対象の注文コード
}
CancelOrderRequest - 注文の取り消しリクエスト
type ComparisonOperator ¶
type ComparisonOperator string
ComparisonOperator - 比較演算子
const ( ComparisonOperatorUnspecified = "" // 未指定 ComparisonOperatorGT ComparisonOperator = "gt" // より大きい ComparisonOperatorGE ComparisonOperator = "ge" // 以上 ComparisonOperatorEQ ComparisonOperator = "eq" // 等しい ComparisonOperatorLE ComparisonOperator = "le" // 以下 ComparisonOperatorLT ComparisonOperator = "lt" // 未満 ComparisonOperatorNE ComparisonOperator = "ne" // 等しくない )
func (ComparisonOperator) CompareFloat64 ¶
func (e ComparisonOperator) CompareFloat64(a, b float64) bool
type Contract ¶
type Contract struct { ContractCode string OrderCode string PositionCode string Price float64 Quantity float64 ContractedAt time.Time }
Contract - 約定
type ExchangeType ¶
type ExchangeType string
ExchangeType - 市場種別
const ( ExchangeTypeUnspecified ExchangeType = "" // 未指定 ExchangeTypeStock ExchangeType = "stock" // 株式現物 ExchangeTypeMargin ExchangeType = "margin" // 株式信用 ExchangeTypeFuture ExchangeType = "future" // 先物 )
type ExitPosition ¶ added in v0.0.6
type HoldPosition ¶ added in v0.0.6
type HoldPosition struct { PositionCode string // ポジションコード HoldQuantity float64 // 拘束数 ExitQuantity float64 // 返済数 }
HoldPosition - 注文が拘束しているポジションの情報
type MarginOrder ¶ added in v0.0.6
type MarginOrder struct { Code string // 注文コード OrderStatus OrderStatus // 状態 TradeType TradeType // 取引区分 Side Side // 売買方向 ExecutionCondition StockExecutionCondition // 株式執行条件 SymbolCode string // 銘柄コード OrderQuantity float64 // 注文数量 ContractedQuantity float64 // 約定数量 CanceledQuantity float64 // 取消数量 LimitPrice float64 // 指値価格 ExpiredAt time.Time // 有効期限 StopCondition *StockStopCondition // 現物逆指値条件 ExitPositionList []ExitPosition // エグジットポジションリスト OrderedAt time.Time // 注文日時 CanceledAt time.Time // 取消日時 Contracts []*Contract // 約定一覧 Message string // メッセージ }
MarginOrder - 信用注文
type MarginOrderRequest ¶ added in v0.0.6
type MarginOrderRequest struct { TradeType TradeType // 取引区分 Side Side // 売買方向 ExecutionCondition StockExecutionCondition // 株式執行条件 SymbolCode string // 銘柄コード Quantity float64 // 注文数量 (複数のポジションを指定してエグジットする場合は、合計数量を入れる) LimitPrice float64 // 指値価格 ExpiredAt time.Time // 有効期限 StopCondition *StockStopCondition // 現物逆指値条件 ExitPositionList []ExitPosition // エグジットポジションリスト }
MarginOrderRequest - 信用注文リクエスト
type MarginPosition ¶ added in v0.0.6
type MarginPosition struct { Code string // ポジションコード OrderCode string // 注文コード SymbolCode string // 銘柄コード Side Side // 売買方向 ContractedQuantity float64 // 約定数量 OwnedQuantity float64 // 保有数量 HoldQuantity float64 // 拘束数量 Price float64 // 約定価格 ContractedAt time.Time // 約定日時 }
MarginPosition - 信用ポジション
type OrderStatus ¶
type OrderStatus string
OrderStatus - 注文状態
const ( OrderStatusUnspecified OrderStatus = "" // 未指定 OrderStatusNew OrderStatus = "new" // 新規 OrderStatusWait OrderStatus = "wait" // 待機 OrderStatusInOrder OrderStatus = "in_order" // 注文中 OrderStatusPart OrderStatus = "part" // 部分約定 OrderStatusDone OrderStatus = "done" // 全約定 OrderStatusInCancel OrderStatus = "in_cancel" // 取消中 OrderStatusCanceled OrderStatus = "canceled" // 取消済み )
func (OrderStatus) IsCancelable ¶
func (e OrderStatus) IsCancelable() bool
func (OrderStatus) IsContractable ¶
func (e OrderStatus) IsContractable() bool
func (OrderStatus) IsFixed ¶
func (e OrderStatus) IsFixed() bool
type OrderSummary ¶
type OrderSummary struct { OrderCode string SymbolCode string // 銘柄コード ExchangeType ExchangeType // 市場種別 Status OrderStatus }
OrderSummary - 注文概要
type RegisterPriceRequest ¶
type RegisterPriceRequest struct { ExchangeType ExchangeType // 市場種別 SymbolCode string // 銘柄コード Price float64 // 価格 PriceTime time.Time // 価格日時 Bid float64 // 買気配値 BidTime time.Time // 買気配日時 Ask float64 // 売気配値 AskTime time.Time // 売気配日時 }
RegisterPriceRequest - 銘柄価格のリクエスト
type StockExecutionCondition ¶
type StockExecutionCondition string
StockExecutionCondition - 執行条件
const ( StockExecutionConditionUnspecified StockExecutionCondition = "" // 未指定 StockExecutionConditionMO StockExecutionCondition = "market_order" // 成行 StockExecutionConditionMOMO StockExecutionCondition = "market_order_on_morning_opening" // 寄成(前場) StockExecutionConditionMOAO StockExecutionCondition = "market_order_on_afternoon_opening" // 寄成(後場) StockExecutionConditionMOMC StockExecutionCondition = "market_order_on_morning_closing" // 引成(前場) StockExecutionConditionMOAC StockExecutionCondition = "market_order_on_afternoon_closing" // 引成(後場) StockExecutionConditionIOCMO StockExecutionCondition = "ioc_market_order" // IOC成行 StockExecutionConditionLO StockExecutionCondition = "limit_order" // 指値 StockExecutionConditionLOMO StockExecutionCondition = "limit_order_on_morning_opening" // 寄指(前場) StockExecutionConditionLOAO StockExecutionCondition = "limit_order_on_afternoon_opening" // 寄指(後場) StockExecutionConditionLOMC StockExecutionCondition = "limit_order_on_morning_closing" // 引指(前場) StockExecutionConditionLOAC StockExecutionCondition = "limit_order_on_afternoon_closing" // 引指(後場) StockExecutionConditionIOCLO StockExecutionCondition = "ioc_limit_order" // IOC指値 StockExecutionConditionFunariM StockExecutionCondition = "funari_on_morning" // 不成(前場) StockExecutionConditionFunariA StockExecutionCondition = "funari_on_afternoon" // 不成(後場) StockExecutionConditionStop StockExecutionCondition = "stop" // 逆指値 )
func (StockExecutionCondition) IsContractableAfternoonSession ¶
func (e StockExecutionCondition) IsContractableAfternoonSession() bool
func (StockExecutionCondition) IsContractableAfternoonSessionClosing ¶
func (e StockExecutionCondition) IsContractableAfternoonSessionClosing() bool
func (StockExecutionCondition) IsContractableMorningSession ¶
func (e StockExecutionCondition) IsContractableMorningSession() bool
func (StockExecutionCondition) IsContractableMorningSessionClosing ¶
func (e StockExecutionCondition) IsContractableMorningSessionClosing() bool
func (StockExecutionCondition) IsFunari ¶
func (e StockExecutionCondition) IsFunari() bool
func (StockExecutionCondition) IsLimitOrder ¶
func (e StockExecutionCondition) IsLimitOrder() bool
func (StockExecutionCondition) IsMarketOrder ¶
func (e StockExecutionCondition) IsMarketOrder() bool
func (StockExecutionCondition) IsStop ¶
func (e StockExecutionCondition) IsStop() bool
type StockOrder ¶
type StockOrder struct { Code string // 注文コード OrderStatus OrderStatus // 状態 Side Side // 売買方向 ExecutionCondition StockExecutionCondition // 株式執行条件 SymbolCode string // 銘柄コード OrderQuantity float64 // 注文数量 ContractedQuantity float64 // 約定数量 CanceledQuantity float64 // 取消数量 LimitPrice float64 // 指値価格 ExpiredAt time.Time // 有効期限 StopCondition *StockStopCondition // 現物逆指値条件 OrderedAt time.Time // 注文日時 CanceledAt time.Time // 取消日時 Contracts []*Contract // 約定一覧 Message string // メッセージ }
StockOrder - 現物注文
type StockOrderRequest ¶
type StockOrderRequest struct { Side Side // 売買方向 ExecutionCondition StockExecutionCondition // 株式執行条件 SymbolCode string // 銘柄コード Quantity float64 // 注文数量 LimitPrice float64 // 指値価格 ExpiredAt time.Time // 有効期限 StopCondition *StockStopCondition // 現物逆指値条件 }
StockOrderRequest - 現物注文リクエスト
type StockPosition ¶
type StockPosition struct { Code string // ポジションコード OrderCode string // 注文コード SymbolCode string // 銘柄コード Side Side // 売買方向 ContractedQuantity float64 // 約定数量 OwnedQuantity float64 // 保有数量 HoldQuantity float64 // 拘束数量 Price float64 // 約定価格 ContractedAt time.Time // 約定日時 }
StockPosition - 現物ポジション
type StockStopCondition ¶
type StockStopCondition struct { StopPrice float64 // 逆指値発動価格 ComparisonOperator ComparisonOperator // 比較方法 ExecutionConditionAfterHit StockExecutionCondition // 逆指値発動後注文条件 LimitPriceAfterHit float64 // 逆指値発動後指値価格 ActivatedAt time.Time // 逆指値条件が満たされた日時 // contains filtered or unexported fields }
StockStopCondition - 逆指値条件
type UpdatedOrders ¶
type UpdatedOrders struct {
Orders []OrderSummary // 更新された注文
}
UpdatedOrders - 更新された注文
type VirtualSecurity ¶
type VirtualSecurity interface { RegisterPrice(symbolPrice RegisterPriceRequest) error // 銘柄価格の登録 StockOrder(order *StockOrderRequest) (*OrderResult, error) // 現物注文 CancelStockOrder(cancelOrder *CancelOrderRequest) error // 現物注文の取り消し StockOrders() ([]*StockOrder, error) // 現物注文一覧 StockPositions() ([]*StockPosition, error) // 現物ポジション一覧 MarginOrder(order *MarginOrderRequest) (*OrderResult, error) // 信用注文 CancelMarginOrder(cancelOrder *CancelOrderRequest) error // 信用注文の取り消し MarginOrders() ([]*MarginOrder, error) // 信用注文一覧 MarginPositions() ([]*MarginPosition, error) // 信用ポジション一覧 }
func NewVirtualSecurity ¶
func NewVirtualSecurity() VirtualSecurity
Source Files ¶
- clock.go
- enums.go
- error.go
- margin_order.go
- margin_order_store.go
- margin_position.go
- margin_position_store.go
- margin_service.go
- price_service.go
- price_store.go
- stock_contract_component.go
- stock_order.go
- stock_order_store.go
- stock_position.go
- stock_position_store.go
- stock_service.go
- time.go
- uuid.go
- validator_component.go
- values.go
- virtual_security.go
Click to show internal directories.
Click to hide internal directories.