35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package tacitus
|
|
|
|
import (
|
|
"github.com/shopspring/decimal"
|
|
|
|
"time"
|
|
)
|
|
|
|
type Trade struct {
|
|
Id int `json:"-"`
|
|
TradeId int `json:"trade_id,"`
|
|
Product string `json:"product,"`
|
|
Price decimal.Decimal `json:"price,"`
|
|
Size decimal.Decimal `json:"size,"`
|
|
Buy bool `json:"buy,"`
|
|
Sell bool `json:"sell,"`
|
|
Timestamp time.Time `json:"timestamp,"`
|
|
}
|
|
|
|
type TradeService interface {
|
|
CreateTrade(t Trade) (Trade, error)
|
|
DeleteTrade(id int)
|
|
|
|
Trade(id int) (Trade, error)
|
|
TradeByTradeId(id int, prod string) (Trade, error)
|
|
TradesInDateRange(product string, start, end time.Time) ([]Trade, error)
|
|
FirstTrades(product string, limit int) ([]Trade, error)
|
|
LastTrades(product string, limit int) ([]Trade, error)
|
|
TradesAfter(product string, id, limit int) ([]Trade, error)
|
|
TradesBefore(product string, id, limit int) ([]Trade, error)
|
|
|
|
TradesAfterAll(product string, id int) (Results, error)
|
|
TradesWhereResults(sql string, params ...interface{}) (Results, error)
|
|
}
|