func (s *OrderService) CancelOrderMultiOp(orderID int) (*notification.Notification, error) {
	pld := OrderMultiOpsRequest{
		Ops: OrderOps{
			{
				"oc",
				map[string]int{"id": orderID},
			},
		},
	}
	bytes, err := json.Marshal(pld)
	if err != nil {
		return nil, err
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithBytes(
		common.PermissionWrite,
		path.Join("order", "multi"),
		bytes,
	)
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return notification.FromRaw(raw)
}
CancelOrderMultiOp cancels order. Accepts orderID to be canceled.
see https://docs.bitfinex.com/reference#rest-auth-order-multi for more info
package rest
import (
	"encoding/json"
	"fmt"
	"path"
	"github.com/bitfinexcom/bitfinex-api-go/pkg/models/common"
	"github.com/bitfinexcom/bitfinex-api-go/pkg/models/notification"
	"github.com/bitfinexcom/bitfinex-api-go/pkg/models/order"
	"github.com/bitfinexcom/bitfinex-api-go/pkg/models/tradeexecutionupdate"
)
type OrderService struct {
	requestFactory
	Synchronous
}
type OrderIDs []int
type GroupOrderIDs []int
type ClientOrderIDs [][]interface{}
type OrderOps [][]interface{}
type OrderMultiOpsRequest struct {
	Ops OrderOps `json:"ops"`
}
type CancelOrderMultiRequest struct {
	OrderIDs       OrderIDs       `json:"id,omitempty"`
	GroupOrderIDs  GroupOrderIDs  `json:"gid,omitempty"`
	ClientOrderIDs ClientOrderIDs `json:"cid,omitempty"`
	All            int            `json:"all,omitempty"`
}
func (s *OrderService) All() (*order.Snapshot, error) {
	return s.getActiveOrders("")
}
func (s *OrderService) GetBySymbol(symbol string) (*order.Snapshot, error) {
	return s.getActiveOrders(symbol)
}
func (s *OrderService) GetByOrderId(orderID int64) (o *order.Order, err error) {
	os, err := s.All()
	if err != nil {
		return nil, err
	}
	for _, order := range os.Snapshot {
		if order.ID == orderID {
			return order, nil
		}
	}
	return nil, common.ErrNotFound
}
func (s *OrderService) AllHistory() (*order.Snapshot, error) {
	return s.getHistoricalOrders("")
}
func (s *OrderService) GetHistoryBySymbol(symbol string) (*order.Snapshot, error) {
	return s.getHistoricalOrders(symbol)
}
func (s *OrderService) GetHistoryByOrderId(orderID int64) (o *order.Order, err error) {
	os, err := s.AllHistory()
	if err != nil {
		return nil, err
	}
	for _, order := range os.Snapshot {
		if order.ID == orderID {
			return order, nil
		}
	}
	return nil, common.ErrNotFound
}
func (s *OrderService) OrderTrades(symbol string, orderID int64) (*tradeexecutionupdate.Snapshot, error) {
	key := fmt.Sprintf("%s:%d", symbol, orderID)
	req, err := s.requestFactory.NewAuthenticatedRequest(common.PermissionRead, path.Join("order", key, "trades"))
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return tradeexecutionupdate.SnapshotFromRaw(raw)
}
func (s *OrderService) getActiveOrders(symbol string) (*order.Snapshot, error) {
	req, err := s.requestFactory.NewAuthenticatedRequest(common.PermissionRead, path.Join("orders", symbol))
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	os, err := order.SnapshotFromRaw(raw)
	if err != nil {
		return nil, err
	}
	if os == nil {
		return &order.Snapshot{}, nil
	}
	return os, nil
}
func (s *OrderService) getHistoricalOrders(symbol string) (*order.Snapshot, error) {
	req, err := s.requestFactory.NewAuthenticatedRequest(common.PermissionRead, path.Join("orders", symbol, "hist"))
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	os, err := order.SnapshotFromRaw(raw)
	if err != nil {
		return nil, err
	}
	if os == nil {
		return &order.Snapshot{}, nil
	}
	return os, nil
}
func (s *OrderService) SubmitOrder(onr *order.NewRequest) (*notification.Notification, error) {
	bytes, err := onr.ToJSON()
	if err != nil {
		return nil, err
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithBytes(common.PermissionWrite, path.Join("order", "submit"), bytes)
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return notification.FromRaw(raw)
}
func (s *OrderService) SubmitUpdateOrder(our *order.UpdateRequest) (*notification.Notification, error) {
	bytes, err := our.ToJSON()
	if err != nil {
		return nil, err
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithBytes(common.PermissionWrite, path.Join("order", "update"), bytes)
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return notification.FromRaw(raw)
}
func (s *OrderService) SubmitCancelOrder(oc *order.CancelRequest) error {
	bytes, err := oc.ToJSON()
	if err != nil {
		return err
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithBytes(common.PermissionWrite, path.Join("order", "cancel"), bytes)
	if err != nil {
		return err
	}
	_, err = s.Request(req)
	if err != nil {
		return err
	}
	return nil
}
func (s *OrderService) CancelOrderMulti(args CancelOrderMultiRequest) (*notification.Notification, error) {
	bytes, err := json.Marshal(args)
	if err != nil {
		return nil, err
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithBytes(
		common.PermissionWrite,
		path.Join("order", "cancel", "multi"),
		bytes,
	)
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return notification.FromRaw(raw)
}
func (s *OrderService) CancelOrdersMultiOp(ids OrderIDs) (*notification.Notification, error) {
	pld := OrderMultiOpsRequest{
		Ops: OrderOps{
			{
				"oc_multi",
				map[string][]int{"id": ids},
			},
		},
	}
	bytes, err := json.Marshal(pld)
	if err != nil {
		return nil, err
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithBytes(
		common.PermissionWrite,
		path.Join("order", "multi"),
		bytes,
	)
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return notification.FromRaw(raw)
}