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) } }
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) } }