Documentation
¶
Index ¶
- func CalculateBuyOrderPriceByAnyPer(high, rate float64) float64
- func CalculateSellOrderPriceByAnyPer(lastBuyOrderPrice, limitRate, stopRate float64) (limitPrice, stopPrice float64)
- func CheckAvailableOrderSize(price, available float64) float64
- func CheckTradeMode() int
- func GETBalance(currencyCode string) (available float64)
- func GETChildOrderID(parentOrderID string) string
- func GETConf(w http.ResponseWriter, r *http.Request)
- func GETExecution(childOrderID string) bool
- func GETParentOrderID(parentOrderAcceptionID string) string
- func GETTicker() (hi, la, lo float64)
- func POSTChildOrder(price, size float64) string
- func POSTParentOrder(limitPrice, stopPrice, size float64) string
- func PUTConf(w http.ResponseWriter, r *http.Request)
- func ReadBuyOrderInfo(columnNum int) interface{}
- func ReadConf() (AccessKey, SecretKey string)
- func ReadIsReady() (IsReady int)
- func ReadSellOrderInfo(columnNum int) interface{}
- func ReadTickerInfo() float64
- func UpdateTradeMode(mode int)
- func WriteBuyOrderInfo(price, size float64, childOrderID string)
- func WriteSellOrderInfo(price, size float64, childOrderID string)
- func WriteTickerInfo(high, low, last float64) bool
- type BalanceResponse
- type ChildOrder
- type ChildOrderResponse
- type Conf
- type Executions
- type Mode
- type ParentOrder
- type ParentOrderResponse
- type TickerInfo
- type TickerParent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateBuyOrderPriceByAnyPer ¶
CalculateBuyOrderPriceByAnyPer 指値で買い注文を出す際の価格を分析する関数 最高取引価格、any%を引数とし、指値注文での価格を戻り値とする any%ルールを適用した場合の価格とする
func CalculateSellOrderPriceByAnyPer ¶
func CalculateSellOrderPriceByAnyPer(lastBuyOrderPrice, limitRate, stopRate float64) (limitPrice, stopPrice float64)
CalculateSellOrderPriceByAnyPer 売値の注文価格を決める関数 引数は買い注文価格とany%。戻り値は、売値の指値注文の価格、逆指値注文の価格とする。
func CheckAvailableOrderSize ¶
CheckAvailableOrderSize 注文可能数量をチェックするための関数 価格と利用可能数量を引数とし、数量を返り値とする
func CheckTradeMode ¶
func CheckTradeMode() int
CheckTradeMode 自動取引jobにて、モードを確認するための関数 引数なし、戻り値はモードとする
func GETBalance ¶
GETBalance 残高を取得するための関数 クエリパラメータで通過の種類を引数とし、残高を返り値とする
func GETChildOrderID ¶
GETChildOrderID 親注文Idをキーにして子注文Idを取得するための関数 ParentOrderIdを引数として、ChildOrderAcceptionIdを戻り値とする
func GETConf ¶
func GETConf(w http.ResponseWriter, r *http.Request)
GETConf アクセスキー、シークレットキーをdbから読み取るための関数。 confに対してGETメソッドを送った場合に利用する
func GETExecution ¶
GETExecution 約定履歴を取得するための関数。 order_idを引数として、boolを返り値とする。 ToDo:引数を指定した上で約定履歴を獲得できるようにする。
func GETParentOrderID ¶
GETParentOrderID 親注文受付Idをキーにして親注文Idを取得するための関数 ParentOrderAcceptanceIDを引数として、ParentOrderIdを戻り値とする
func GETTicker ¶
func GETTicker() (hi, la, lo float64)
Tickerから最新の最高価格、最終価格、最低価格を入手するための関数 引数なし、戻り値はtickerから取得した最高価格、最終取引価格、最低価格
func POSTChildOrder ¶
POSTChildOrder 子注文を出すための関数。基本的には買い注文のみで利用する。 指値の買い注文価格を引数として、order_idを返り値とする
func POSTParentOrder ¶
POSTParentOrder 親注文を出すための関数。基本的には売り注文のみで使う。 指値の売り注文価格と、逆指値の売り注文価格を引数とし、order_idを返り値とする。
func PUTConf ¶
func PUTConf(w http.ResponseWriter, r *http.Request)
PUTConf アクセスキーを更新するための関数。confに対してPUTメソッドを送った場合に利用する
func ReadBuyOrderInfo ¶
func ReadBuyOrderInfo(columnNum int) interface{}
ReadBuyOrderInfo 買い注文履歴を読み取るための関数 引数はカラム番号。戻り値は、カラム番号にひもづく値をinterface型を戻り値とする。
func ReadConf ¶
func ReadConf() (AccessKey, SecretKey string)
ReadConf アクセスキー、シークレットキーをdbから読み取る関数 戻り値はaccessKeyとシークレットキー
func ReadIsReady ¶
func ReadIsReady() (IsReady int)
ReadIsReady アクセスキー、シークレットキーが設定済みか確認する関数 引数なし、isReadyを戻り値とする(未:0 済:1)
func ReadSellOrderInfo ¶
func ReadSellOrderInfo(columnNum int) interface{}
ReadSellOrderInfo 売り注文履歴を読み取るための関数 引数はカラム番号。戻り値は、カラム番号にひもづく値をinterface型を戻り値とする。 HACK: カラム番号で返り値を取得しているが、他にいい方法がないか検討
func ReadTickerInfo ¶
func ReadTickerInfo() float64
ReadTickerInfo tikcer_infoテーブルから、最新の最高取引価格を取り出す関数 引数なし、戻り値は最新の取引価格(float64)
func UpdateTradeMode ¶
func UpdateTradeMode(mode int)
UpdateTradeMode 取引モードを更新するための関数。 モード番号を引数とする。返り値なし
func WriteBuyOrderInfo ¶
WriteBuyOrderInfo 買い注文履歴を保存するための関数 価格と数量とorder_idを引数とする。
func WriteSellOrderInfo ¶
WriteSellOrderInfo 売り注文情報を書き込むための関数 引数はprice、size、order_idとする。
func WriteTickerInfo ¶
WriteTickerInfo tickerの最高価格、最低価格、最終価格をDBに書き込む関数 引数は最高価格、最低価格、最終価格とし、戻り値はboolとする
Types ¶
type BalanceResponse ¶
type BalanceResponse struct {
CurrencyCode string `json:"currency_code"`
Amount float64 `json:"amount"`
Available float64 `json:"available"`
}
BalanceResponse bitFlyerLightnintAPIから残高情報を取得するための構造体
type ChildOrder ¶
type ChildOrder struct {
ID int `json:"id"`
ChildOrderID string `json:"child_order_id"`
ProductCode string `json:"product_code"`
Side string `json:"side"`
ChildOrderType string `json:"child_order_type"`
Price float64 `json:"price"`
AveragePrice float64 `json:"average_price"`
Size float64 `json:"size"`
ChildOrderState string `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"`
}
type ChildOrderResponse ¶
type ChildOrderResponse struct {
ChildOrderAcceptanceID string `json:"child_order_acceptance_id"`
}
ChildOrderResponse 子注文のIDを格納するための構造体
type Executions ¶
type Executions struct {
ID int `json:"id"`
ChildOrderID string `json:"child_order_id"`
Side string `json:"side"`
Price float64 `json:"price"`
Size float64 `json:"size"`
Commission float64 `json:"commission"`
ExecDate string `json:"exec_date"`
ChildOrderAcceptanceID string `json:"child_order_acceptance_id"`
}
type ParentOrder ¶
type ParentOrder struct {
ID int `json:"id"`
ParentOrderID string `json:"parent_order_id"`
OrderMethod string `json:"order_method"`
ExpireDate string `json:"expire_date"`
TimeInForce string `json:"time_in_force"`
Parameters []struct {
ProductCode string `json:"product_code"`
ConditionType string `json:"condition_type"`
Side string `json:"side"`
Price float64 `json:"price"`
Size float64 `json:"size"`
TriggerPrice float64 `json:"trigger_price"`
Offset float64 `json:"offset"`
} `json:"parameters"`
ParentOrderAcceptanceID string `json:"parent_order_acceptance_id"`
}
type ParentOrderResponse ¶
type ParentOrderResponse struct {
ParentOrderAcceptanceID string `json:"parent_order_acceptance_id"`
}
type TickerInfo ¶
TickerInfo トレンド分析用に利用するtickerデータの構造体
type TickerParent ¶
type TickerParent struct {
ProductCode string `json:"product_code"`
State string `json:"state"`
Timestamp string `json:"timestamp"`
TickID int `json:"tick_id"`
BestBid float64 `json:"best_bid"` //最低売価格
BestAsk float64 `json:"best_ask"` //最高買価格
BestBidSize float64 `json:"best_bid_size"`
BestAskSize int `json:"best_ask_size"`
TotalBidDepth float64 `json:"total_bid_depth"`
TotalAskDepth int `json:"total_ask_depth"`
MarketBidSize int `json:"market_bid_size"`
MarketAskSize int `json:"market_ask_size"`
Ltp float64 `json:"ltp"` //最終取引価格
Volume float64 `json:"volume"`
VolumeByProduct float64 `json:"volume_by_product"`
}
TickerParent : bitFlyerAPIから取得するtickerデータの構造体