Documentation ¶
Index ¶
- Constants
- Variables
- func NewLogger(out io.Writer) *log.Logger
- type CandlestickData
- type Client
- func (c *Client) AddOrder(ctx context.Context, ordertype string, amount, price int64) (*Order, error)
- func (c *Client) DeleteOrders(ctx context.Context, id int64) error
- func (c *Client) GetOrders(ctx context.Context) ([]Order, error)
- func (c *Client) Info(ctx context.Context, cursor int64) (*InfoResponse, error)
- func (c *Client) Initialize(ctx context.Context, bankep, bankid, logep, logid string) error
- func (c *Client) IsRetired() bool
- func (c *Client) Signin(ctx context.Context) error
- func (c *Client) Signout(ctx context.Context) error
- func (c *Client) Signup(ctx context.Context) error
- func (c *Client) Top(ctx context.Context) error
- func (c *Client) UserID() int64
- type ErrElapsedTimeOverRetire
- type ErrorWithStatus
- type FinalState
- type InfoResponse
- type Manager
- func (c *Manager) ActiveUsers() int
- func (c *Manager) AddScore(score int64)
- func (c *Manager) AllUsers() int
- func (c *Manager) AppendError(e error) error
- func (c *Manager) Close()
- func (c *Manager) ErrorCount() int
- func (c *Manager) FetchNewID() string
- func (c *Manager) FinalScore() int64
- func (c *Manager) GetErrorsString() []string
- func (c *Manager) GetLevel() uint
- func (c *Manager) GetLogs() ([]string, error)
- func (c *Manager) GetScore() int64
- func (c *Manager) Initialize(ctx context.Context) error
- func (c *Manager) Logger() *log.Logger
- func (c *Manager) PostTest(ctx context.Context) error
- func (c *Manager) PreTest(ctx context.Context) error
- func (c *Manager) RunIDFetcher(ctx context.Context)
- func (c *Manager) ScenarioStart(ctx context.Context) error
- func (c *Manager) TotalScore() int64
- type Order
- type OrderActionResponse
- type PostTester
- type PreTester
- type Random
- type ResponseWithElapsedTime
- type Runner
- type Scenario
- type ScoreBoard
- type ScoreMsg
- type ScoreType
- type StaticFile
- type StatusRes
- type TestUser
- type Trade
- type User
Constants ¶
View Source
const ( UserAgent = "Isutrader/0.0.1" TradeTypeSell = "sell" TradeTypeBuy = "buy" )
View Source
const ( // Timeouts BenchMarkTime = 60 * time.Second // 負荷走行の時間 TickerInterval = 20 * time.Millisecond // tickerのinterval InitTimeout = 30 * time.Second // Initialize のタイムアウト ClientTimeout = 15 * time.Second // HTTP clientのタイムアウト RetireTimeout = 10 * time.Second // clientが退役するタイムアウト時間 RetryInterval = 500 * time.Millisecond // 50x系でエラーになったときのretry間隔 TestTradeTimeout = 5 * time.Second // testでのtradeは成立までの時間 LogAllowedDelay = 10 * time.Second // logの遅延が許される時間 PollingInterval = 1000 * time.Millisecond // clientのポーリング感覚 OrderUpdateInterval = 1500 * time.Millisecond // 注文間隔 BruteForceDelay = 500 * time.Millisecond // 総当たりログイン試行間隔 AddUsersOnNatural = 2 // 自然増で増えるユーザー数 DefaultWorkers = 10 // 初期 BruteForceWorkers = 2 // ログインを試行してくるユーザー // Scores SignupScore = 3 SigninScore = 3 GetTradesScore = 1 PostOrdersScore = 5 GetOrdersScore = 1 DeleteOrdersScore = 5 TradeSuccessScore = 10 GetInfoScore = 1 GetTopScore = 1 // error AllowErrorMin = 20 // levelによらずここまでは許容範囲というエラー数 AllowErrorMax = 50 // levelによらずこれ以上は許さないというエラー数 )
Variables ¶
View Source
var (
ErrAlreadyRetired = errors.New("already retired client")
)
View Source
var StaticFiles = []*StaticFile{ &StaticFile{"/", 886, "3a571469b58349f869846a51327e7cff"}, &StaticFile{"/css/app.033eaee3.css", 11992, "7bf63f337dc2e96d62aefa4c7c482732"}, &StaticFile{"/favicon.ico", 894, "74ba79ca3f41bb01fe12454f4f13bd96"}, &StaticFile{"/img/isucoin_logo.png", 8988, "549012f31fcf8a328bedf6b8cab2b1af"}, &StaticFile{"/js/Chart.Financial.js", 14403, "765490c323c5073857bf15309133edee"}, &StaticFile{"/js/Chart.min.js", 159638, "f6c8efa65711e0cbbc99ba72997ecd0e"}, &StaticFile{"/js/app.2be81752.js", 19425, "ece197c60a70f36b87d2a390428095b9"}, &StaticFile{"/js/chunk-vendors.3f054da5.js", 139427, "d004b96351883062178f479d06dd376a"}, &StaticFile{"/js/moment.min.js", 51679, "8999b8b5d07e9c6077ac5ac6bc942968"}, }
Functions ¶
Types ¶
type CandlestickData ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Initialize ¶
type ErrElapsedTimeOverRetire ¶
type ErrElapsedTimeOverRetire struct {
// contains filtered or unexported fields
}
func (*ErrElapsedTimeOverRetire) Error ¶
func (e *ErrElapsedTimeOverRetire) Error() string
type ErrorWithStatus ¶
type ErrorWithStatus struct { StatusCode int Body string // contains filtered or unexported fields }
func (*ErrorWithStatus) Error ¶
func (e *ErrorWithStatus) Error() string
type FinalState ¶
type InfoResponse ¶
type InfoResponse struct { Cursor int64 `json:"cursor"` TradedOrders []Order `json:"traded_orders"` LowestSellPrice int64 `json:"lowest_sell_price"` HighestBuyPrice int64 `json:"highest_buy_price"` ChartBySec []CandlestickData `json:"chart_by_sec"` ChartByMin []CandlestickData `json:"chart_by_min"` ChartByHour []CandlestickData `json:"chart_by_hour"` }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) ActiveUsers ¶
func (*Manager) AppendError ¶
func (*Manager) ErrorCount ¶
func (*Manager) FetchNewID ¶
func (*Manager) FinalScore ¶
func (*Manager) GetErrorsString ¶
func (*Manager) RunIDFetcher ¶
benchに影響を与えないようにidは予め用意しておく
func (*Manager) TotalScore ¶
type Order ¶
type Order struct { ID int64 `json:"id"` Type string `json:"type"` UserID int64 `json:"user_id"` Amount int64 `json:"amount"` Price int64 `json:"price"` ClosedAt *time.Time `json:"closed_at"` TradeID int64 `json:"trade_id,omitempty"` CreatedAt time.Time `json:"created_at"` User *User `json:"user,omitempty"` Trade *Trade `json:"trade,omitempty"` }
type OrderActionResponse ¶
type OrderActionResponse struct {
ID int64 `json:"id"`
}
type PostTester ¶
type PostTester struct {
// contains filtered or unexported fields
}
type ResponseWithElapsedTime ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) Result ¶
func (r *Runner) Result() portal.BenchResult
type Scenario ¶
type Scenario interface { Start(context.Context, chan ScoreMsg) error IsSignin() bool IsRetired() bool BankID() string Credit() int64 }
func NewBruteForceScenario ¶
func NewExistsUserScenario ¶
type ScoreBoard ¶
type ScoreBoard struct {
// contains filtered or unexported fields
}
func (*ScoreBoard) Add ¶
func (sb *ScoreBoard) Add(p ScoreType)
func (*ScoreBoard) Dump ¶
func (sb *ScoreBoard) Dump()
type StaticFile ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.