func order_and_cancel(info gofighter.TradingInfo, order gofighter.ShortOrder) {
	res, err := gofighter.Execute(info, order, nil)
	if err != nil {
		fmt.Println(err)
		return
	}
	time.Sleep(5 * time.Second)
	id := res.Id
	gofighter.Cancel(info, id)
}
func order_cancel_report(info gofighter.TradingInfo, order gofighter.ShortOrder, move_chan chan gofighter.Movement) {
	res, err := gofighter.Execute(info, order, nil)
	if err != nil {
		fmt.Println(err)
		move_chan <- gofighter.Movement{} // For consistency, send message even on failure
		return
	}
	time.Sleep(5 * time.Second)
	id := res.Id
	res, err = gofighter.Cancel(info, id)
	if err != nil {
		fmt.Println(err)
		move_chan <- gofighter.Movement{} // For consistency, send message even on failure
		return
	}
	move_chan <- gofighter.MoveFromOrder(res)
	return
}
Пример #3
0
func main() {

	// The following assumes game_start.exe has already been called, and thus that
	// there exists a file in the /gm/ directory which contains info about the level.

	info := gofighter.GetUserSelection("known_levels.json")

	// The info var above now contains account, venue, and symbol. So we just need
	// the following pieces of information; the ShortOrder type is designed for this.

	order := gofighter.ShortOrder{
		Direction: "buy",
		OrderType: "limit",
		Qty:       100,
		Price:     10000,
	}

	result, _ := gofighter.Execute(info, order, nil)
	gofighter.PrintJSON(result)
}
Пример #4
0
func execute(args []string) {
	result, err := gofighter.Execute(info, order, nil)
	print_error_or_json(result, err)
}