model

package
v0.0.0-...-787e22e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hash string, password string) error

func CompareHashAndSessionID

func CompareHashAndSessionID(hash string, sessionID string) error

func NewSessionID

func NewSessionID() (string, error)

func PasswordHash

func PasswordHash(password string) (string, error)

func SessionIdHash

func SessionIdHash(sessionID string) (string, error)

Types

type AverageCandle

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

平均足

func NewAverageCandle

func NewAverageCandle(candles []Candle) *AverageCandle

func (*AverageCandle) Closes

func (ac *AverageCandle) Closes() []float64

func (*AverageCandle) High

func (ac *AverageCandle) High() []float64

func (*AverageCandle) Lows

func (ac *AverageCandle) Lows() []float64

func (*AverageCandle) Opens

func (ac *AverageCandle) Opens() []float64

type BBands

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

ボリンジャーバンド

func NewBBands

func NewBBands(inReal []float64, n int, k float64) *BBands

func (*BBands) Down

func (bbands *BBands) Down() []float64

func (*BBands) K

func (bbands *BBands) K() float64

func (*BBands) Mid

func (bbands *BBands) Mid() []float64

func (*BBands) N

func (bbands *BBands) N() int

func (*BBands) Up

func (bbands *BBands) Up() []float64

type Balance

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

func NewBalance

func NewBalance(currencyCode string, amount, available float64) *Balance

func (*Balance) Amount

func (b *Balance) Amount() float64

func (*Balance) Available

func (b *Balance) Available() float64

func (*Balance) CurrencyCode

func (b *Balance) CurrencyCode() string

type Candle

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

func NewCandle

func NewCandle(productCode string, duration time.Duration, candleTime CandleTime, open, close, high, low, volume float64) *Candle

func (*Candle) Close

func (candle *Candle) Close() float64

func (*Candle) Duration

func (candle *Candle) Duration() time.Duration

func (*Candle) High

func (candle *Candle) High() float64

func (*Candle) Low

func (candle *Candle) Low() float64

func (*Candle) Open

func (candle *Candle) Open() float64

func (*Candle) ProductCode

func (candle *Candle) ProductCode() string

func (*Candle) Time

func (candle *Candle) Time() CandleTime

func (*Candle) Volume

func (candle *Candle) Volume() float64

type CandleTime

type CandleTime time.Time

func NewCandleTime

func NewCandleTime(timeTime time.Time) CandleTime

func NewCandleTimeByString

func NewCandleTimeByString(timeString string) CandleTime

UTCでパースして返す

func (CandleTime) Equal

func (candleTime CandleTime) Equal(compareTime CandleTime) bool

func (CandleTime) Format

func (candleTime CandleTime) Format(layout string) string

func (CandleTime) Time

func (candleTime CandleTime) Time() time.Time

func (CandleTime) TruncateHour

func (candleTime CandleTime) TruncateHour(localTime *time.Location, hour int) CandleTime

hour時を境に切り捨てた時間

type ChildOrderType

type ChildOrderType string
const (
	ChildOrderTypeLimit  ChildOrderType = "LIMIT"  // 指値注文
	ChildOrderTypeMarket ChildOrderType = "MARKET" // 成行注文
)

type DataFrame

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

func NewDataFrame

func NewDataFrame(productCode string, candles []Candle, events *SignalEvents) *DataFrame

func (*DataFrame) AddAverageCandle

func (df *DataFrame) AddAverageCandle() bool

func (*DataFrame) AddBBands

func (df *DataFrame) AddBBands(n int, k float64) bool

func (*DataFrame) AddBacktestEvents

func (df *DataFrame) AddBacktestEvents(events *SignalEvents)

func (*DataFrame) AddEMA

func (df *DataFrame) AddEMA(period int) bool

func (*DataFrame) AddIchimoku

func (df *DataFrame) AddIchimoku() bool

func (*DataFrame) AddMACD

func (df *DataFrame) AddMACD(inFastPeriod, inSlowPeriod, inSignalPeriod int) bool

func (*DataFrame) AddRSI

func (df *DataFrame) AddRSI(period int) bool

func (*DataFrame) AddSMA

func (df *DataFrame) AddSMA(period int) bool

func (*DataFrame) AverageCandle

func (df *DataFrame) AverageCandle() *AverageCandle

func (*DataFrame) BBands

func (df *DataFrame) BBands() *BBands

func (*DataFrame) BacktestEvents

func (df *DataFrame) BacktestEvents() *SignalEvents

func (*DataFrame) Candles

func (df *DataFrame) Candles() []Candle

func (*DataFrame) Closes

func (df *DataFrame) Closes() []float64

func (*DataFrame) EMAs

func (df *DataFrame) EMAs() []EMA

func (*DataFrame) Events

func (df *DataFrame) Events() *SignalEvents

func (*DataFrame) Highs

func (df *DataFrame) Highs() []float64

func (*DataFrame) IchimokuCloud

func (df *DataFrame) IchimokuCloud() *IchimokuCloud

func (*DataFrame) IsBoxedRange

func (df *DataFrame) IsBoxedRange(period, at int) bool

レンジ相場かどうか判定する 一定期間RSIが40-60の間を推移していれば,レンジ相場

func (*DataFrame) Lows

func (df *DataFrame) Lows() []float64

func (*DataFrame) MACD

func (df *DataFrame) MACD() *MACD

func (*DataFrame) Opens

func (df *DataFrame) Opens() []float64

func (*DataFrame) ProductCode

func (df *DataFrame) ProductCode() string

func (*DataFrame) RSI

func (df *DataFrame) RSI() *RSI

func (*DataFrame) SMAs

func (df *DataFrame) SMAs() []SMA

func (*DataFrame) Times

func (df *DataFrame) Times() []CandleTime

func (*DataFrame) Volumes

func (df *DataFrame) Volumes() []float64

type EMA

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

指数平滑移動平均線

func NewEMA

func NewEMA(inReal []float64, period int) *EMA

func (*EMA) Period

func (ema *EMA) Period() int

func (*EMA) Values

func (ema *EMA) Values() []float64

type IchimokuCloud

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

一目均衡表

func NewIchimokuCloud

func NewIchimokuCloud(inReal []float64) *IchimokuCloud

func (*IchimokuCloud) Chikou

func (ichimokuCloud *IchimokuCloud) Chikou() []float64

func (*IchimokuCloud) Kijun

func (ichimokuCloud *IchimokuCloud) Kijun() []float64

func (*IchimokuCloud) SenkouA

func (ichimokuCloud *IchimokuCloud) SenkouA() []float64

func (*IchimokuCloud) SenkouB

func (ichimokuCloud *IchimokuCloud) SenkouB() []float64

func (*IchimokuCloud) Tenkan

func (ichimokuCloud *IchimokuCloud) Tenkan() []float64

type MACD

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

Moving Average Convergence/Divergence: 移動平均・収束拡散

func NewMACD

func NewMACD(inReal []float64, inFastPeriod, inSlowPeriod, inSignalPeriod int) *MACD

func (*MACD) FastPeriod

func (macd *MACD) FastPeriod() int

func (*MACD) Macd

func (macd *MACD) Macd() []float64

func (*MACD) MacdHist

func (macd *MACD) MacdHist() []float64

func (*MACD) MacdSignal

func (macd *MACD) MacdSignal() []float64

func (*MACD) SignalPeriod

func (macd *MACD) SignalPeriod() int

func (*MACD) SlowPeriod

func (macd *MACD) SlowPeriod() int

type Order

type Order struct {
	ID                     int            `json:"id"`
	ProductCode            string         `json:"product_code"`
	ChildOrderType         ChildOrderType `json:"child_order_type"`
	Side                   OrderSide      `json:"side"`
	Price                  float64        `json:"price"`
	AveragePrice           float64        `json:"average_price"`
	Size                   float64        `json:"size"`
	MinuteToExpires        int            `json:"minute_to_expire"`
	TimeInForce            TimeInForce    `json:"time_in_force"`
	ChildOrderID           string         `json:"child_order_id"`
	ChildOrderState        OrderState     `json:"child_order_state"`
	ExpireDate             string         `json:"expire_date"`
	ChildOrderDate         string         `json:"child_order_date"`
	ChildOrderAcceptanceID string         `json:"child_order_acceptance_id"`
	OutstandingSize        float64        `json:"outstanding_size"`
	CancelSize             float64        `json:"cancel_size"`
	ExecutedSize           float64        `json:"executed_size"`
	TotalCommission        float64        `json:"total_commission"`
}

新規注文リクエスト 注文一覧レスポンス

func NewBuyOrder

func NewBuyOrder(productCode string, size float64) *Order

func NewSellOrder

func NewSellOrder(productCode string, size float64) *Order

type OrderSide

type OrderSide string
const (
	OrderSideBuy  OrderSide = "BUY"  // 買い注文
	OrderSideSell OrderSide = "SELL" // 売り注文
)

type OrderState

type OrderState string
const (
	OrderStateActive    OrderState = "ACTIVE"    // オープンな注文
	OrderStateCompleted OrderState = "COMPLETED" // 全額が取引完了した注文
	OrderStateCanceled  OrderState = "CANCELED"  // キャンセルした注文
	OrderStateExpired   OrderState = "EXPIRED"   // 有効期限に到達したため取り消された注文
	OrderStateRejected  OrderState = "REJECTED"  // 失敗した注文
)

type RSI

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

Relative Strength Index

func NewRSI

func NewRSI(inReal []float64, period int) *RSI

func (*RSI) Period

func (rsi *RSI) Period() int

func (*RSI) Values

func (rsi *RSI) Values() []float64

type SMA

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

単純移動平均

func NewSMA

func NewSMA(inReal []float64, period int) *SMA

func (*SMA) Period

func (sma *SMA) Period() int

func (*SMA) Values

func (sma *SMA) Values() []float64

type SignalEvent

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

func NewSignalEvent

func NewSignalEvent(timeTime time.Time, productCode string, side OrderSide, price float64, size float64) *SignalEvent

func (*SignalEvent) Price

func (s *SignalEvent) Price() float64

func (*SignalEvent) ProductCode

func (s *SignalEvent) ProductCode() string

func (*SignalEvent) Side

func (s *SignalEvent) Side() OrderSide

func (*SignalEvent) Size

func (s *SignalEvent) Size() float64

func (*SignalEvent) Time

func (s *SignalEvent) Time() time.Time

type SignalEvents

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

func NewSignalEvents

func NewSignalEvents(signals []SignalEvent) *SignalEvents

func (*SignalEvents) AddBuySignal

func (s *SignalEvents) AddBuySignal(signal SignalEvent) bool

func (*SignalEvents) AddSellSignal

func (s *SignalEvents) AddSellSignal(signal SignalEvent) bool

func (*SignalEvents) CanBuyAt

func (s *SignalEvents) CanBuyAt(timeTime time.Time) bool

func (*SignalEvents) CanSellAt

func (s *SignalEvents) CanSellAt(timeTime time.Time) bool

func (*SignalEvents) EstimateProfit

func (s *SignalEvents) EstimateProfit() float64

買って売ってを繰り返した履歴データから,利益を推定

func (*SignalEvents) LastSignal

func (s *SignalEvents) LastSignal() *SignalEvent

func (*SignalEvents) Profit

func (s *SignalEvents) Profit() float64

func (*SignalEvents) ShouldCutLoss

func (s *SignalEvents) ShouldCutLoss(currentPrice, stopLimitPercent float64) bool

損切りすべきか判断する 最近の買い注文の後

func (*SignalEvents) Signals

func (s *SignalEvents) Signals() []SignalEvent

type Ticker

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

func NewTicker

func NewTicker(productCode, state string, timestamp string, tickID int, bestBid, bestAsk, bestBidSize, bestAskSize, totalBidDepth, totalAskDepth, marketBidSize, marketAskSize, ltp, volume, volumeByProduct float64) *Ticker

func (*Ticker) BestAsk

func (t *Ticker) BestAsk() float64

func (*Ticker) BestBid

func (t *Ticker) BestBid() float64

func (*Ticker) MidPrice

func (t *Ticker) MidPrice() float64

func (*Ticker) ProductCode

func (t *Ticker) ProductCode() string

func (*Ticker) Timestamp

func (t *Ticker) Timestamp() string

func (*Ticker) Volume

func (t *Ticker) Volume() float64

type TimeInForce

type TimeInForce string

執行数量条件

const (
	TimeInForceGTC TimeInForce = "GTC" // default
	TimeInForceIOC TimeInForce = "IOC"
	TimeInForceFOK TimeInForce = "FOK"
)

type TradeParams

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

func NewBasicTradeParams

func NewBasicTradeParams(productCode string, size float64) *TradeParams

func NewTradeParams

func NewTradeParams(tradeEnable bool, productCode string, size float64,
	smaEnable bool, smaPeriod1, smaPeriod2, smaPeriod3 int,
	emaEnable bool, emaPeriod1, emaPeriod2, emaPeriod3 int,
	bbandsEnable bool, bbandsN int, bbandsK float64,
	ichimokuEnable bool,
	rsiEnable bool, rsiPeriod int, rsiBuyThread, rsiSellThread float64,
	macdEnable bool, macdFastPeriod, macdSlowPeriod, macdSignalPeriod int,
	stopLimitPercent float64) *TradeParams

func (*TradeParams) BBandsEnable

func (tp *TradeParams) BBandsEnable() bool

func (*TradeParams) BBandsK

func (tp *TradeParams) BBandsK() float64

func (*TradeParams) BBandsN

func (tp *TradeParams) BBandsN() int

func (*TradeParams) EMAEnable

func (tp *TradeParams) EMAEnable() bool

func (*TradeParams) EMAPeriod1

func (tp *TradeParams) EMAPeriod1() int

func (*TradeParams) EMAPeriod2

func (tp *TradeParams) EMAPeriod2() int

func (*TradeParams) EMAPeriod3

func (tp *TradeParams) EMAPeriod3() int

func (*TradeParams) EnableBBands

func (tp *TradeParams) EnableBBands(enable bool)

func (*TradeParams) EnableEMA

func (tp *TradeParams) EnableEMA(enable bool)

func (*TradeParams) EnableIchimoku

func (tp *TradeParams) EnableIchimoku(enable bool)

func (*TradeParams) EnableMACD

func (tp *TradeParams) EnableMACD(enable bool)

func (*TradeParams) EnableRSI

func (tp *TradeParams) EnableRSI(enable bool)

func (*TradeParams) EnableSMA

func (tp *TradeParams) EnableSMA(enable bool)

func (*TradeParams) IchimokuEnable

func (tp *TradeParams) IchimokuEnable() bool

func (*TradeParams) MACDEnable

func (tp *TradeParams) MACDEnable() bool

func (*TradeParams) MACDFastPeriod

func (tp *TradeParams) MACDFastPeriod() int

func (*TradeParams) MACDSignalPeriod

func (tp *TradeParams) MACDSignalPeriod() int

func (*TradeParams) MACDSlowPeriod

func (tp *TradeParams) MACDSlowPeriod() int

func (*TradeParams) ProductCode

func (tp *TradeParams) ProductCode() string

func (*TradeParams) RSIBuyThread

func (tp *TradeParams) RSIBuyThread() float64

func (*TradeParams) RSIEnable

func (tp *TradeParams) RSIEnable() bool

func (*TradeParams) RSIPeriod

func (tp *TradeParams) RSIPeriod() int

func (*TradeParams) RSISellThread

func (tp *TradeParams) RSISellThread() float64

func (*TradeParams) SMAEnable

func (tp *TradeParams) SMAEnable() bool

func (*TradeParams) SMAPeriod1

func (tp *TradeParams) SMAPeriod1() int

func (*TradeParams) SMAPeriod2

func (tp *TradeParams) SMAPeriod2() int

func (*TradeParams) SMAPeriod3

func (tp *TradeParams) SMAPeriod3() int

func (*TradeParams) Size

func (tp *TradeParams) Size() float64

func (*TradeParams) StopLimitPercent

func (tp *TradeParams) StopLimitPercent() float64

func (*TradeParams) TradeEnable

func (tp *TradeParams) TradeEnable() bool

type User

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

func NewUser

func NewUser(id string, password string, sessionID string) *User

func (*User) ID

func (user *User) ID() string

func (*User) Password

func (user *User) Password() string

func (*User) SessionID

func (user *User) SessionID() string

Jump to

Keyboard shortcuts

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