Example #1
0
func CloseAllPositions(c *check.C, client *oanda.Client) {
	positions, err := client.Positions()
	c.Assert(err, check.IsNil)

	for _, pos := range positions {
		_, err = client.ClosePosition(pos.Instrument)
		c.Assert(err, check.IsNil)
	}
}
Example #2
0
func CancelAllOrders(c *check.C, client *oanda.Client) {
	if client == nil {
		return
	}

	orders, err := client.Orders()
	c.Assert(err, check.IsNil)

	for _, o := range orders {
		_, err := client.CancelOrder(o.OrderId)
		c.Assert(err, check.IsNil)
	}
}