<?php
/**
 * Position
 *
 * PHP version 5
 *
 * @category Class
 * @package  Swagger\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * BitMEX API
 *
 * ## REST API for the BitMEX Trading Platform  _If you are building automated tools, please subscribe to the_ _[BitMEX API RSS Feed](https://blog.bitmex.com/api_announcement/feed/) for changes. The feed will be updated_ _regularly and is the most reliable way to get downtime and update announcements._  [View Changelog](/app/apiChangelog)  -  #### Getting Started  Base URI: [https://www.bitmex.com/api/v1](/api/v1)  ##### Fetching Data  All REST endpoints are documented below. You can try out any query right from this interface.  Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first.  Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](/app/restAPI).  _All_ table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits.  ##### Return Types  By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data.  ##### Trade Data Queries  _This is only a small subset of what is available, to get you started._  Fill in the parameters and click the `Try it out!` button to try any of these queries.  - [Pricing Data](#!/Quote/Quote_get)  - [Trade Data](#!/Trade/Trade_get)  - [OrderBook Data](#!/OrderBook/OrderBook_getL2)  - [Settlement Data](#!/Settlement/Settlement_get)  - [Exchange Statistics](#!/Stats/Stats_history)  Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available.  ##### Swagger Specification  [⇩ Download Swagger JSON](swagger.json)  -  ## All API Endpoints  Click to expand a section.
 *
 * OpenAPI spec version: 1.2.0
 * Contact: support@bitmex.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.42-SNAPSHOT
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace Swagger\Client\Model;

use \ArrayAccess;
use \Swagger\Client\ObjectSerializer;

/**
 * Position Class Doc Comment
 *
 * @category Class
 * @description Summary of Open and Closed Positions
 * @package  Swagger\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class Position implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $swaggerModelName = 'Position';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'account' => 'int',
        'symbol' => 'string',
        'currency' => 'string',
        'underlying' => 'string',
        'quote_currency' => 'string',
        'commission' => 'double',
        'init_margin_req' => 'double',
        'maint_margin_req' => 'double',
        'risk_limit' => 'int',
        'leverage' => 'double',
        'cross_margin' => 'bool',
        'deleverage_percentile' => 'double',
        'rebalanced_pnl' => 'int',
        'prev_realised_pnl' => 'int',
        'prev_unrealised_pnl' => 'int',
        'opening_qty' => 'int',
        'open_order_buy_qty' => 'int',
        'open_order_buy_cost' => 'int',
        'open_order_buy_premium' => 'int',
        'open_order_sell_qty' => 'int',
        'open_order_sell_cost' => 'int',
        'open_order_sell_premium' => 'int',
        'current_qty' => 'int',
        'current_cost' => 'int',
        'current_comm' => 'int',
        'realised_cost' => 'int',
        'unrealised_cost' => 'int',
        'gross_open_premium' => 'int',
        'is_open' => 'bool',
        'mark_price' => 'double',
        'mark_value' => 'int',
        'risk_value' => 'int',
        'home_notional' => 'double',
        'foreign_notional' => 'double',
        'pos_state' => 'string',
        'pos_cost' => 'int',
        'pos_cross' => 'int',
        'pos_comm' => 'int',
        'pos_loss' => 'int',
        'pos_margin' => 'int',
        'pos_maint' => 'int',
        'init_margin' => 'int',
        'maint_margin' => 'int',
        'realised_pnl' => 'int',
        'unrealised_pnl' => 'int',
        'unrealised_pnl_pcnt' => 'double',
        'unrealised_roe_pcnt' => 'double',
        'avg_cost_price' => 'double',
        'avg_entry_price' => 'double',
        'break_even_price' => 'double',
        'margin_call_price' => 'double',
        'liquidation_price' => 'double',
        'bankrupt_price' => 'double',
        'timestamp' => '\DateTime'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'account' => 'int64',
        'symbol' => null,
        'currency' => null,
        'underlying' => null,
        'quote_currency' => null,
        'commission' => 'double',
        'init_margin_req' => 'double',
        'maint_margin_req' => 'double',
        'risk_limit' => 'int64',
        'leverage' => 'double',
        'cross_margin' => null,
        'deleverage_percentile' => 'double',
        'rebalanced_pnl' => 'int64',
        'prev_realised_pnl' => 'int64',
        'prev_unrealised_pnl' => 'int64',
        'opening_qty' => 'int64',
        'open_order_buy_qty' => 'int64',
        'open_order_buy_cost' => 'int64',
        'open_order_buy_premium' => 'int64',
        'open_order_sell_qty' => 'int64',
        'open_order_sell_cost' => 'int64',
        'open_order_sell_premium' => 'int64',
        'current_qty' => 'int64',
        'current_cost' => 'int64',
        'current_comm' => 'int64',
        'realised_cost' => 'int64',
        'unrealised_cost' => 'int64',
        'gross_open_premium' => 'int64',
        'is_open' => null,
        'mark_price' => 'double',
        'mark_value' => 'int64',
        'risk_value' => 'int64',
        'home_notional' => 'double',
        'foreign_notional' => 'double',
        'pos_state' => null,
        'pos_cost' => 'int64',
        'pos_cross' => 'int64',
        'pos_comm' => 'int64',
        'pos_loss' => 'int64',
        'pos_margin' => 'int64',
        'pos_maint' => 'int64',
        'init_margin' => 'int64',
        'maint_margin' => 'int64',
        'realised_pnl' => 'int64',
        'unrealised_pnl' => 'int64',
        'unrealised_pnl_pcnt' => 'double',
        'unrealised_roe_pcnt' => 'double',
        'avg_cost_price' => 'double',
        'avg_entry_price' => 'double',
        'break_even_price' => 'double',
        'margin_call_price' => 'double',
        'liquidation_price' => 'double',
        'bankrupt_price' => 'double',
        'timestamp' => 'date-time'
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerTypes()
    {
        return self::$swaggerTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerFormats()
    {
        return self::$swaggerFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'account' => 'account',
        'symbol' => 'symbol',
        'currency' => 'currency',
        'underlying' => 'underlying',
        'quote_currency' => 'quoteCurrency',
        'commission' => 'commission',
        'init_margin_req' => 'initMarginReq',
        'maint_margin_req' => 'maintMarginReq',
        'risk_limit' => 'riskLimit',
        'leverage' => 'leverage',
        'cross_margin' => 'crossMargin',
        'deleverage_percentile' => 'deleveragePercentile',
        'rebalanced_pnl' => 'rebalancedPnl',
        'prev_realised_pnl' => 'prevRealisedPnl',
        'prev_unrealised_pnl' => 'prevUnrealisedPnl',
        'opening_qty' => 'openingQty',
        'open_order_buy_qty' => 'openOrderBuyQty',
        'open_order_buy_cost' => 'openOrderBuyCost',
        'open_order_buy_premium' => 'openOrderBuyPremium',
        'open_order_sell_qty' => 'openOrderSellQty',
        'open_order_sell_cost' => 'openOrderSellCost',
        'open_order_sell_premium' => 'openOrderSellPremium',
        'current_qty' => 'currentQty',
        'current_cost' => 'currentCost',
        'current_comm' => 'currentComm',
        'realised_cost' => 'realisedCost',
        'unrealised_cost' => 'unrealisedCost',
        'gross_open_premium' => 'grossOpenPremium',
        'is_open' => 'isOpen',
        'mark_price' => 'markPrice',
        'mark_value' => 'markValue',
        'risk_value' => 'riskValue',
        'home_notional' => 'homeNotional',
        'foreign_notional' => 'foreignNotional',
        'pos_state' => 'posState',
        'pos_cost' => 'posCost',
        'pos_cross' => 'posCross',
        'pos_comm' => 'posComm',
        'pos_loss' => 'posLoss',
        'pos_margin' => 'posMargin',
        'pos_maint' => 'posMaint',
        'init_margin' => 'initMargin',
        'maint_margin' => 'maintMargin',
        'realised_pnl' => 'realisedPnl',
        'unrealised_pnl' => 'unrealisedPnl',
        'unrealised_pnl_pcnt' => 'unrealisedPnlPcnt',
        'unrealised_roe_pcnt' => 'unrealisedRoePcnt',
        'avg_cost_price' => 'avgCostPrice',
        'avg_entry_price' => 'avgEntryPrice',
        'break_even_price' => 'breakEvenPrice',
        'margin_call_price' => 'marginCallPrice',
        'liquidation_price' => 'liquidationPrice',
        'bankrupt_price' => 'bankruptPrice',
        'timestamp' => 'timestamp'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'account' => 'setAccount',
        'symbol' => 'setSymbol',
        'currency' => 'setCurrency',
        'underlying' => 'setUnderlying',
        'quote_currency' => 'setQuoteCurrency',
        'commission' => 'setCommission',
        'init_margin_req' => 'setInitMarginReq',
        'maint_margin_req' => 'setMaintMarginReq',
        'risk_limit' => 'setRiskLimit',
        'leverage' => 'setLeverage',
        'cross_margin' => 'setCrossMargin',
        'deleverage_percentile' => 'setDeleveragePercentile',
        'rebalanced_pnl' => 'setRebalancedPnl',
        'prev_realised_pnl' => 'setPrevRealisedPnl',
        'prev_unrealised_pnl' => 'setPrevUnrealisedPnl',
        'opening_qty' => 'setOpeningQty',
        'open_order_buy_qty' => 'setOpenOrderBuyQty',
        'open_order_buy_cost' => 'setOpenOrderBuyCost',
        'open_order_buy_premium' => 'setOpenOrderBuyPremium',
        'open_order_sell_qty' => 'setOpenOrderSellQty',
        'open_order_sell_cost' => 'setOpenOrderSellCost',
        'open_order_sell_premium' => 'setOpenOrderSellPremium',
        'current_qty' => 'setCurrentQty',
        'current_cost' => 'setCurrentCost',
        'current_comm' => 'setCurrentComm',
        'realised_cost' => 'setRealisedCost',
        'unrealised_cost' => 'setUnrealisedCost',
        'gross_open_premium' => 'setGrossOpenPremium',
        'is_open' => 'setIsOpen',
        'mark_price' => 'setMarkPrice',
        'mark_value' => 'setMarkValue',
        'risk_value' => 'setRiskValue',
        'home_notional' => 'setHomeNotional',
        'foreign_notional' => 'setForeignNotional',
        'pos_state' => 'setPosState',
        'pos_cost' => 'setPosCost',
        'pos_cross' => 'setPosCross',
        'pos_comm' => 'setPosComm',
        'pos_loss' => 'setPosLoss',
        'pos_margin' => 'setPosMargin',
        'pos_maint' => 'setPosMaint',
        'init_margin' => 'setInitMargin',
        'maint_margin' => 'setMaintMargin',
        'realised_pnl' => 'setRealisedPnl',
        'unrealised_pnl' => 'setUnrealisedPnl',
        'unrealised_pnl_pcnt' => 'setUnrealisedPnlPcnt',
        'unrealised_roe_pcnt' => 'setUnrealisedRoePcnt',
        'avg_cost_price' => 'setAvgCostPrice',
        'avg_entry_price' => 'setAvgEntryPrice',
        'break_even_price' => 'setBreakEvenPrice',
        'margin_call_price' => 'setMarginCallPrice',
        'liquidation_price' => 'setLiquidationPrice',
        'bankrupt_price' => 'setBankruptPrice',
        'timestamp' => 'setTimestamp'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'account' => 'getAccount',
        'symbol' => 'getSymbol',
        'currency' => 'getCurrency',
        'underlying' => 'getUnderlying',
        'quote_currency' => 'getQuoteCurrency',
        'commission' => 'getCommission',
        'init_margin_req' => 'getInitMarginReq',
        'maint_margin_req' => 'getMaintMarginReq',
        'risk_limit' => 'getRiskLimit',
        'leverage' => 'getLeverage',
        'cross_margin' => 'getCrossMargin',
        'deleverage_percentile' => 'getDeleveragePercentile',
        'rebalanced_pnl' => 'getRebalancedPnl',
        'prev_realised_pnl' => 'getPrevRealisedPnl',
        'prev_unrealised_pnl' => 'getPrevUnrealisedPnl',
        'opening_qty' => 'getOpeningQty',
        'open_order_buy_qty' => 'getOpenOrderBuyQty',
        'open_order_buy_cost' => 'getOpenOrderBuyCost',
        'open_order_buy_premium' => 'getOpenOrderBuyPremium',
        'open_order_sell_qty' => 'getOpenOrderSellQty',
        'open_order_sell_cost' => 'getOpenOrderSellCost',
        'open_order_sell_premium' => 'getOpenOrderSellPremium',
        'current_qty' => 'getCurrentQty',
        'current_cost' => 'getCurrentCost',
        'current_comm' => 'getCurrentComm',
        'realised_cost' => 'getRealisedCost',
        'unrealised_cost' => 'getUnrealisedCost',
        'gross_open_premium' => 'getGrossOpenPremium',
        'is_open' => 'getIsOpen',
        'mark_price' => 'getMarkPrice',
        'mark_value' => 'getMarkValue',
        'risk_value' => 'getRiskValue',
        'home_notional' => 'getHomeNotional',
        'foreign_notional' => 'getForeignNotional',
        'pos_state' => 'getPosState',
        'pos_cost' => 'getPosCost',
        'pos_cross' => 'getPosCross',
        'pos_comm' => 'getPosComm',
        'pos_loss' => 'getPosLoss',
        'pos_margin' => 'getPosMargin',
        'pos_maint' => 'getPosMaint',
        'init_margin' => 'getInitMargin',
        'maint_margin' => 'getMaintMargin',
        'realised_pnl' => 'getRealisedPnl',
        'unrealised_pnl' => 'getUnrealisedPnl',
        'unrealised_pnl_pcnt' => 'getUnrealisedPnlPcnt',
        'unrealised_roe_pcnt' => 'getUnrealisedRoePcnt',
        'avg_cost_price' => 'getAvgCostPrice',
        'avg_entry_price' => 'getAvgEntryPrice',
        'break_even_price' => 'getBreakEvenPrice',
        'margin_call_price' => 'getMarginCallPrice',
        'liquidation_price' => 'getLiquidationPrice',
        'bankrupt_price' => 'getBankruptPrice',
        'timestamp' => 'getTimestamp'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$swaggerModelName;
    }

    

    

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['account'] = isset($data['account']) ? $data['account'] : 0;
        $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null;
        $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null;
        $this->container['underlying'] = isset($data['underlying']) ? $data['underlying'] : null;
        $this->container['quote_currency'] = isset($data['quote_currency']) ? $data['quote_currency'] : null;
        $this->container['commission'] = isset($data['commission']) ? $data['commission'] : 0.0;
        $this->container['init_margin_req'] = isset($data['init_margin_req']) ? $data['init_margin_req'] : 0.0;
        $this->container['maint_margin_req'] = isset($data['maint_margin_req']) ? $data['maint_margin_req'] : 0.0;
        $this->container['risk_limit'] = isset($data['risk_limit']) ? $data['risk_limit'] : 0;
        $this->container['leverage'] = isset($data['leverage']) ? $data['leverage'] : 0.0;
        $this->container['cross_margin'] = isset($data['cross_margin']) ? $data['cross_margin'] : null;
        $this->container['deleverage_percentile'] = isset($data['deleverage_percentile']) ? $data['deleverage_percentile'] : 0.0;
        $this->container['rebalanced_pnl'] = isset($data['rebalanced_pnl']) ? $data['rebalanced_pnl'] : 0;
        $this->container['prev_realised_pnl'] = isset($data['prev_realised_pnl']) ? $data['prev_realised_pnl'] : 0;
        $this->container['prev_unrealised_pnl'] = isset($data['prev_unrealised_pnl']) ? $data['prev_unrealised_pnl'] : 0;
        $this->container['opening_qty'] = isset($data['opening_qty']) ? $data['opening_qty'] : 0;
        $this->container['open_order_buy_qty'] = isset($data['open_order_buy_qty']) ? $data['open_order_buy_qty'] : 0;
        $this->container['open_order_buy_cost'] = isset($data['open_order_buy_cost']) ? $data['open_order_buy_cost'] : 0;
        $this->container['open_order_buy_premium'] = isset($data['open_order_buy_premium']) ? $data['open_order_buy_premium'] : 0;
        $this->container['open_order_sell_qty'] = isset($data['open_order_sell_qty']) ? $data['open_order_sell_qty'] : 0;
        $this->container['open_order_sell_cost'] = isset($data['open_order_sell_cost']) ? $data['open_order_sell_cost'] : 0;
        $this->container['open_order_sell_premium'] = isset($data['open_order_sell_premium']) ? $data['open_order_sell_premium'] : 0;
        $this->container['current_qty'] = isset($data['current_qty']) ? $data['current_qty'] : 0;
        $this->container['current_cost'] = isset($data['current_cost']) ? $data['current_cost'] : 0;
        $this->container['current_comm'] = isset($data['current_comm']) ? $data['current_comm'] : 0;
        $this->container['realised_cost'] = isset($data['realised_cost']) ? $data['realised_cost'] : 0;
        $this->container['unrealised_cost'] = isset($data['unrealised_cost']) ? $data['unrealised_cost'] : 0;
        $this->container['gross_open_premium'] = isset($data['gross_open_premium']) ? $data['gross_open_premium'] : 0;
        $this->container['is_open'] = isset($data['is_open']) ? $data['is_open'] : null;
        $this->container['mark_price'] = isset($data['mark_price']) ? $data['mark_price'] : 0.0;
        $this->container['mark_value'] = isset($data['mark_value']) ? $data['mark_value'] : 0;
        $this->container['risk_value'] = isset($data['risk_value']) ? $data['risk_value'] : 0;
        $this->container['home_notional'] = isset($data['home_notional']) ? $data['home_notional'] : 0.0;
        $this->container['foreign_notional'] = isset($data['foreign_notional']) ? $data['foreign_notional'] : 0.0;
        $this->container['pos_state'] = isset($data['pos_state']) ? $data['pos_state'] : null;
        $this->container['pos_cost'] = isset($data['pos_cost']) ? $data['pos_cost'] : 0;
        $this->container['pos_cross'] = isset($data['pos_cross']) ? $data['pos_cross'] : 0;
        $this->container['pos_comm'] = isset($data['pos_comm']) ? $data['pos_comm'] : 0;
        $this->container['pos_loss'] = isset($data['pos_loss']) ? $data['pos_loss'] : 0;
        $this->container['pos_margin'] = isset($data['pos_margin']) ? $data['pos_margin'] : 0;
        $this->container['pos_maint'] = isset($data['pos_maint']) ? $data['pos_maint'] : 0;
        $this->container['init_margin'] = isset($data['init_margin']) ? $data['init_margin'] : 0;
        $this->container['maint_margin'] = isset($data['maint_margin']) ? $data['maint_margin'] : 0;
        $this->container['realised_pnl'] = isset($data['realised_pnl']) ? $data['realised_pnl'] : 0;
        $this->container['unrealised_pnl'] = isset($data['unrealised_pnl']) ? $data['unrealised_pnl'] : 0;
        $this->container['unrealised_pnl_pcnt'] = isset($data['unrealised_pnl_pcnt']) ? $data['unrealised_pnl_pcnt'] : 0.0;
        $this->container['unrealised_roe_pcnt'] = isset($data['unrealised_roe_pcnt']) ? $data['unrealised_roe_pcnt'] : 0.0;
        $this->container['avg_cost_price'] = isset($data['avg_cost_price']) ? $data['avg_cost_price'] : 0.0;
        $this->container['avg_entry_price'] = isset($data['avg_entry_price']) ? $data['avg_entry_price'] : 0.0;
        $this->container['break_even_price'] = isset($data['break_even_price']) ? $data['break_even_price'] : 0.0;
        $this->container['margin_call_price'] = isset($data['margin_call_price']) ? $data['margin_call_price'] : 0.0;
        $this->container['liquidation_price'] = isset($data['liquidation_price']) ? $data['liquidation_price'] : 0.0;
        $this->container['bankrupt_price'] = isset($data['bankrupt_price']) ? $data['bankrupt_price'] : 0.0;
        $this->container['timestamp'] = isset($data['timestamp']) ? $data['timestamp'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['account'] === null) {
            $invalidProperties[] = "'account' can't be null";
        }
        if ($this->container['symbol'] === null) {
            $invalidProperties[] = "'symbol' can't be null";
        }
        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets account
     *
     * @return int
     */
    public function getAccount()
    {
        return $this->container['account'];
    }

    /**
     * Sets account
     *
     * @param int $account account
     *
     * @return $this
     */
    public function setAccount($account)
    {
        $this->container['account'] = $account;

        return $this;
    }

    /**
     * Gets symbol
     *
     * @return string
     */
    public function getSymbol()
    {
        return $this->container['symbol'];
    }

    /**
     * Sets symbol
     *
     * @param string $symbol symbol
     *
     * @return $this
     */
    public function setSymbol($symbol)
    {
        $this->container['symbol'] = $symbol;

        return $this;
    }

    /**
     * Gets currency
     *
     * @return string
     */
    public function getCurrency()
    {
        return $this->container['currency'];
    }

    /**
     * Sets currency
     *
     * @param string $currency currency
     *
     * @return $this
     */
    public function setCurrency($currency)
    {
        $this->container['currency'] = $currency;

        return $this;
    }

    /**
     * Gets underlying
     *
     * @return string
     */
    public function getUnderlying()
    {
        return $this->container['underlying'];
    }

    /**
     * Sets underlying
     *
     * @param string $underlying underlying
     *
     * @return $this
     */
    public function setUnderlying($underlying)
    {
        $this->container['underlying'] = $underlying;

        return $this;
    }

    /**
     * Gets quote_currency
     *
     * @return string
     */
    public function getQuoteCurrency()
    {
        return $this->container['quote_currency'];
    }

    /**
     * Sets quote_currency
     *
     * @param string $quote_currency quote_currency
     *
     * @return $this
     */
    public function setQuoteCurrency($quote_currency)
    {
        $this->container['quote_currency'] = $quote_currency;

        return $this;
    }

    /**
     * Gets commission
     *
     * @return double
     */
    public function getCommission()
    {
        return $this->container['commission'];
    }

    /**
     * Sets commission
     *
     * @param double $commission commission
     *
     * @return $this
     */
    public function setCommission($commission)
    {
        $this->container['commission'] = $commission;

        return $this;
    }

    /**
     * Gets init_margin_req
     *
     * @return double
     */
    public function getInitMarginReq()
    {
        return $this->container['init_margin_req'];
    }

    /**
     * Sets init_margin_req
     *
     * @param double $init_margin_req init_margin_req
     *
     * @return $this
     */
    public function setInitMarginReq($init_margin_req)
    {
        $this->container['init_margin_req'] = $init_margin_req;

        return $this;
    }

    /**
     * Gets maint_margin_req
     *
     * @return double
     */
    public function getMaintMarginReq()
    {
        return $this->container['maint_margin_req'];
    }

    /**
     * Sets maint_margin_req
     *
     * @param double $maint_margin_req maint_margin_req
     *
     * @return $this
     */
    public function setMaintMarginReq($maint_margin_req)
    {
        $this->container['maint_margin_req'] = $maint_margin_req;

        return $this;
    }

    /**
     * Gets risk_limit
     *
     * @return int
     */
    public function getRiskLimit()
    {
        return $this->container['risk_limit'];
    }

    /**
     * Sets risk_limit
     *
     * @param int $risk_limit risk_limit
     *
     * @return $this
     */
    public function setRiskLimit($risk_limit)
    {
        $this->container['risk_limit'] = $risk_limit;

        return $this;
    }

    /**
     * Gets leverage
     *
     * @return double
     */
    public function getLeverage()
    {
        return $this->container['leverage'];
    }

    /**
     * Sets leverage
     *
     * @param double $leverage leverage
     *
     * @return $this
     */
    public function setLeverage($leverage)
    {
        $this->container['leverage'] = $leverage;

        return $this;
    }

    /**
     * Gets cross_margin
     *
     * @return bool
     */
    public function getCrossMargin()
    {
        return $this->container['cross_margin'];
    }

    /**
     * Sets cross_margin
     *
     * @param bool $cross_margin cross_margin
     *
     * @return $this
     */
    public function setCrossMargin($cross_margin)
    {
        $this->container['cross_margin'] = $cross_margin;

        return $this;
    }

    /**
     * Gets deleverage_percentile
     *
     * @return double
     */
    public function getDeleveragePercentile()
    {
        return $this->container['deleverage_percentile'];
    }

    /**
     * Sets deleverage_percentile
     *
     * @param double $deleverage_percentile deleverage_percentile
     *
     * @return $this
     */
    public function setDeleveragePercentile($deleverage_percentile)
    {
        $this->container['deleverage_percentile'] = $deleverage_percentile;

        return $this;
    }

    /**
     * Gets rebalanced_pnl
     *
     * @return int
     */
    public function getRebalancedPnl()
    {
        return $this->container['rebalanced_pnl'];
    }

    /**
     * Sets rebalanced_pnl
     *
     * @param int $rebalanced_pnl rebalanced_pnl
     *
     * @return $this
     */
    public function setRebalancedPnl($rebalanced_pnl)
    {
        $this->container['rebalanced_pnl'] = $rebalanced_pnl;

        return $this;
    }

    /**
     * Gets prev_realised_pnl
     *
     * @return int
     */
    public function getPrevRealisedPnl()
    {
        return $this->container['prev_realised_pnl'];
    }

    /**
     * Sets prev_realised_pnl
     *
     * @param int $prev_realised_pnl prev_realised_pnl
     *
     * @return $this
     */
    public function setPrevRealisedPnl($prev_realised_pnl)
    {
        $this->container['prev_realised_pnl'] = $prev_realised_pnl;

        return $this;
    }

    /**
     * Gets prev_unrealised_pnl
     *
     * @return int
     */
    public function getPrevUnrealisedPnl()
    {
        return $this->container['prev_unrealised_pnl'];
    }

    /**
     * Sets prev_unrealised_pnl
     *
     * @param int $prev_unrealised_pnl prev_unrealised_pnl
     *
     * @return $this
     */
    public function setPrevUnrealisedPnl($prev_unrealised_pnl)
    {
        $this->container['prev_unrealised_pnl'] = $prev_unrealised_pnl;

        return $this;
    }

    /**
     * Gets opening_qty
     *
     * @return int
     */
    public function getOpeningQty()
    {
        return $this->container['opening_qty'];
    }

    /**
     * Sets opening_qty
     *
     * @param int $opening_qty opening_qty
     *
     * @return $this
     */
    public function setOpeningQty($opening_qty)
    {
        $this->container['opening_qty'] = $opening_qty;

        return $this;
    }

    /**
     * Gets open_order_buy_qty
     *
     * @return int
     */
    public function getOpenOrderBuyQty()
    {
        return $this->container['open_order_buy_qty'];
    }

    /**
     * Sets open_order_buy_qty
     *
     * @param int $open_order_buy_qty open_order_buy_qty
     *
     * @return $this
     */
    public function setOpenOrderBuyQty($open_order_buy_qty)
    {
        $this->container['open_order_buy_qty'] = $open_order_buy_qty;

        return $this;
    }

    /**
     * Gets open_order_buy_cost
     *
     * @return int
     */
    public function getOpenOrderBuyCost()
    {
        return $this->container['open_order_buy_cost'];
    }

    /**
     * Sets open_order_buy_cost
     *
     * @param int $open_order_buy_cost open_order_buy_cost
     *
     * @return $this
     */
    public function setOpenOrderBuyCost($open_order_buy_cost)
    {
        $this->container['open_order_buy_cost'] = $open_order_buy_cost;

        return $this;
    }

    /**
     * Gets open_order_buy_premium
     *
     * @return int
     */
    public function getOpenOrderBuyPremium()
    {
        return $this->container['open_order_buy_premium'];
    }

    /**
     * Sets open_order_buy_premium
     *
     * @param int $open_order_buy_premium open_order_buy_premium
     *
     * @return $this
     */
    public function setOpenOrderBuyPremium($open_order_buy_premium)
    {
        $this->container['open_order_buy_premium'] = $open_order_buy_premium;

        return $this;
    }

    /**
     * Gets open_order_sell_qty
     *
     * @return int
     */
    public function getOpenOrderSellQty()
    {
        return $this->container['open_order_sell_qty'];
    }

    /**
     * Sets open_order_sell_qty
     *
     * @param int $open_order_sell_qty open_order_sell_qty
     *
     * @return $this
     */
    public function setOpenOrderSellQty($open_order_sell_qty)
    {
        $this->container['open_order_sell_qty'] = $open_order_sell_qty;

        return $this;
    }

    /**
     * Gets open_order_sell_cost
     *
     * @return int
     */
    public function getOpenOrderSellCost()
    {
        return $this->container['open_order_sell_cost'];
    }

    /**
     * Sets open_order_sell_cost
     *
     * @param int $open_order_sell_cost open_order_sell_cost
     *
     * @return $this
     */
    public function setOpenOrderSellCost($open_order_sell_cost)
    {
        $this->container['open_order_sell_cost'] = $open_order_sell_cost;

        return $this;
    }

    /**
     * Gets open_order_sell_premium
     *
     * @return int
     */
    public function getOpenOrderSellPremium()
    {
        return $this->container['open_order_sell_premium'];
    }

    /**
     * Sets open_order_sell_premium
     *
     * @param int $open_order_sell_premium open_order_sell_premium
     *
     * @return $this
     */
    public function setOpenOrderSellPremium($open_order_sell_premium)
    {
        $this->container['open_order_sell_premium'] = $open_order_sell_premium;

        return $this;
    }

    /**
     * Gets current_qty
     *
     * @return int
     */
    public function getCurrentQty()
    {
        return $this->container['current_qty'];
    }

    /**
     * Sets current_qty
     *
     * @param int $current_qty current_qty
     *
     * @return $this
     */
    public function setCurrentQty($current_qty)
    {
        $this->container['current_qty'] = $current_qty;

        return $this;
    }

    /**
     * Gets current_cost
     *
     * @return int
     */
    public function getCurrentCost()
    {
        return $this->container['current_cost'];
    }

    /**
     * Sets current_cost
     *
     * @param int $current_cost current_cost
     *
     * @return $this
     */
    public function setCurrentCost($current_cost)
    {
        $this->container['current_cost'] = $current_cost;

        return $this;
    }

    /**
     * Gets current_comm
     *
     * @return int
     */
    public function getCurrentComm()
    {
        return $this->container['current_comm'];
    }

    /**
     * Sets current_comm
     *
     * @param int $current_comm current_comm
     *
     * @return $this
     */
    public function setCurrentComm($current_comm)
    {
        $this->container['current_comm'] = $current_comm;

        return $this;
    }

    /**
     * Gets realised_cost
     *
     * @return int
     */
    public function getRealisedCost()
    {
        return $this->container['realised_cost'];
    }

    /**
     * Sets realised_cost
     *
     * @param int $realised_cost realised_cost
     *
     * @return $this
     */
    public function setRealisedCost($realised_cost)
    {
        $this->container['realised_cost'] = $realised_cost;

        return $this;
    }

    /**
     * Gets unrealised_cost
     *
     * @return int
     */
    public function getUnrealisedCost()
    {
        return $this->container['unrealised_cost'];
    }

    /**
     * Sets unrealised_cost
     *
     * @param int $unrealised_cost unrealised_cost
     *
     * @return $this
     */
    public function setUnrealisedCost($unrealised_cost)
    {
        $this->container['unrealised_cost'] = $unrealised_cost;

        return $this;
    }

    /**
     * Gets gross_open_premium
     *
     * @return int
     */
    public function getGrossOpenPremium()
    {
        return $this->container['gross_open_premium'];
    }

    /**
     * Sets gross_open_premium
     *
     * @param int $gross_open_premium gross_open_premium
     *
     * @return $this
     */
    public function setGrossOpenPremium($gross_open_premium)
    {
        $this->container['gross_open_premium'] = $gross_open_premium;

        return $this;
    }

    /**
     * Gets is_open
     *
     * @return bool
     */
    public function getIsOpen()
    {
        return $this->container['is_open'];
    }

    /**
     * Sets is_open
     *
     * @param bool $is_open is_open
     *
     * @return $this
     */
    public function setIsOpen($is_open)
    {
        $this->container['is_open'] = $is_open;

        return $this;
    }

    /**
     * Gets mark_price
     *
     * @return double
     */
    public function getMarkPrice()
    {
        return $this->container['mark_price'];
    }

    /**
     * Sets mark_price
     *
     * @param double $mark_price mark_price
     *
     * @return $this
     */
    public function setMarkPrice($mark_price)
    {
        $this->container['mark_price'] = $mark_price;

        return $this;
    }

    /**
     * Gets mark_value
     *
     * @return int
     */
    public function getMarkValue()
    {
        return $this->container['mark_value'];
    }

    /**
     * Sets mark_value
     *
     * @param int $mark_value mark_value
     *
     * @return $this
     */
    public function setMarkValue($mark_value)
    {
        $this->container['mark_value'] = $mark_value;

        return $this;
    }

    /**
     * Gets risk_value
     *
     * @return int
     */
    public function getRiskValue()
    {
        return $this->container['risk_value'];
    }

    /**
     * Sets risk_value
     *
     * @param int $risk_value risk_value
     *
     * @return $this
     */
    public function setRiskValue($risk_value)
    {
        $this->container['risk_value'] = $risk_value;

        return $this;
    }

    /**
     * Gets home_notional
     *
     * @return double
     */
    public function getHomeNotional()
    {
        return $this->container['home_notional'];
    }

    /**
     * Sets home_notional
     *
     * @param double $home_notional home_notional
     *
     * @return $this
     */
    public function setHomeNotional($home_notional)
    {
        $this->container['home_notional'] = $home_notional;

        return $this;
    }

    /**
     * Gets foreign_notional
     *
     * @return double
     */
    public function getForeignNotional()
    {
        return $this->container['foreign_notional'];
    }

    /**
     * Sets foreign_notional
     *
     * @param double $foreign_notional foreign_notional
     *
     * @return $this
     */
    public function setForeignNotional($foreign_notional)
    {
        $this->container['foreign_notional'] = $foreign_notional;

        return $this;
    }

    /**
     * Gets pos_state
     *
     * @return string
     */
    public function getPosState()
    {
        return $this->container['pos_state'];
    }

    /**
     * Sets pos_state
     *
     * @param string $pos_state pos_state
     *
     * @return $this
     */
    public function setPosState($pos_state)
    {
        $this->container['pos_state'] = $pos_state;

        return $this;
    }

    /**
     * Gets pos_cost
     *
     * @return int
     */
    public function getPosCost()
    {
        return $this->container['pos_cost'];
    }

    /**
     * Sets pos_cost
     *
     * @param int $pos_cost pos_cost
     *
     * @return $this
     */
    public function setPosCost($pos_cost)
    {
        $this->container['pos_cost'] = $pos_cost;

        return $this;
    }

    /**
     * Gets pos_cross
     *
     * @return int
     */
    public function getPosCross()
    {
        return $this->container['pos_cross'];
    }

    /**
     * Sets pos_cross
     *
     * @param int $pos_cross pos_cross
     *
     * @return $this
     */
    public function setPosCross($pos_cross)
    {
        $this->container['pos_cross'] = $pos_cross;

        return $this;
    }

    /**
     * Gets pos_comm
     *
     * @return int
     */
    public function getPosComm()
    {
        return $this->container['pos_comm'];
    }

    /**
     * Sets pos_comm
     *
     * @param int $pos_comm pos_comm
     *
     * @return $this
     */
    public function setPosComm($pos_comm)
    {
        $this->container['pos_comm'] = $pos_comm;

        return $this;
    }

    /**
     * Gets pos_loss
     *
     * @return int
     */
    public function getPosLoss()
    {
        return $this->container['pos_loss'];
    }

    /**
     * Sets pos_loss
     *
     * @param int $pos_loss pos_loss
     *
     * @return $this
     */
    public function setPosLoss($pos_loss)
    {
        $this->container['pos_loss'] = $pos_loss;

        return $this;
    }

    /**
     * Gets pos_margin
     *
     * @return int
     */
    public function getPosMargin()
    {
        return $this->container['pos_margin'];
    }

    /**
     * Sets pos_margin
     *
     * @param int $pos_margin pos_margin
     *
     * @return $this
     */
    public function setPosMargin($pos_margin)
    {
        $this->container['pos_margin'] = $pos_margin;

        return $this;
    }

    /**
     * Gets pos_maint
     *
     * @return int
     */
    public function getPosMaint()
    {
        return $this->container['pos_maint'];
    }

    /**
     * Sets pos_maint
     *
     * @param int $pos_maint pos_maint
     *
     * @return $this
     */
    public function setPosMaint($pos_maint)
    {
        $this->container['pos_maint'] = $pos_maint;

        return $this;
    }

    /**
     * Gets init_margin
     *
     * @return int
     */
    public function getInitMargin()
    {
        return $this->container['init_margin'];
    }

    /**
     * Sets init_margin
     *
     * @param int $init_margin init_margin
     *
     * @return $this
     */
    public function setInitMargin($init_margin)
    {
        $this->container['init_margin'] = $init_margin;

        return $this;
    }

    /**
     * Gets maint_margin
     *
     * @return int
     */
    public function getMaintMargin()
    {
        return $this->container['maint_margin'];
    }

    /**
     * Sets maint_margin
     *
     * @param int $maint_margin maint_margin
     *
     * @return $this
     */
    public function setMaintMargin($maint_margin)
    {
        $this->container['maint_margin'] = $maint_margin;

        return $this;
    }

    /**
     * Gets realised_pnl
     *
     * @return int
     */
    public function getRealisedPnl()
    {
        return $this->container['realised_pnl'];
    }

    /**
     * Sets realised_pnl
     *
     * @param int $realised_pnl realised_pnl
     *
     * @return $this
     */
    public function setRealisedPnl($realised_pnl)
    {
        $this->container['realised_pnl'] = $realised_pnl;

        return $this;
    }

    /**
     * Gets unrealised_pnl
     *
     * @return int
     */
    public function getUnrealisedPnl()
    {
        return $this->container['unrealised_pnl'];
    }

    /**
     * Sets unrealised_pnl
     *
     * @param int $unrealised_pnl unrealised_pnl
     *
     * @return $this
     */
    public function setUnrealisedPnl($unrealised_pnl)
    {
        $this->container['unrealised_pnl'] = $unrealised_pnl;

        return $this;
    }

    /**
     * Gets unrealised_pnl_pcnt
     *
     * @return double
     */
    public function getUnrealisedPnlPcnt()
    {
        return $this->container['unrealised_pnl_pcnt'];
    }

    /**
     * Sets unrealised_pnl_pcnt
     *
     * @param double $unrealised_pnl_pcnt unrealised_pnl_pcnt
     *
     * @return $this
     */
    public function setUnrealisedPnlPcnt($unrealised_pnl_pcnt)
    {
        $this->container['unrealised_pnl_pcnt'] = $unrealised_pnl_pcnt;

        return $this;
    }

    /**
     * Gets unrealised_roe_pcnt
     *
     * @return double
     */
    public function getUnrealisedRoePcnt()
    {
        return $this->container['unrealised_roe_pcnt'];
    }

    /**
     * Sets unrealised_roe_pcnt
     *
     * @param double $unrealised_roe_pcnt unrealised_roe_pcnt
     *
     * @return $this
     */
    public function setUnrealisedRoePcnt($unrealised_roe_pcnt)
    {
        $this->container['unrealised_roe_pcnt'] = $unrealised_roe_pcnt;

        return $this;
    }

    /**
     * Gets avg_cost_price
     *
     * @return double
     */
    public function getAvgCostPrice()
    {
        return $this->container['avg_cost_price'];
    }

    /**
     * Sets avg_cost_price
     *
     * @param double $avg_cost_price avg_cost_price
     *
     * @return $this
     */
    public function setAvgCostPrice($avg_cost_price)
    {
        $this->container['avg_cost_price'] = $avg_cost_price;

        return $this;
    }

    /**
     * Gets avg_entry_price
     *
     * @return double
     */
    public function getAvgEntryPrice()
    {
        return $this->container['avg_entry_price'];
    }

    /**
     * Sets avg_entry_price
     *
     * @param double $avg_entry_price avg_entry_price
     *
     * @return $this
     */
    public function setAvgEntryPrice($avg_entry_price)
    {
        $this->container['avg_entry_price'] = $avg_entry_price;

        return $this;
    }

    /**
     * Gets break_even_price
     *
     * @return double
     */
    public function getBreakEvenPrice()
    {
        return $this->container['break_even_price'];
    }

    /**
     * Sets break_even_price
     *
     * @param double $break_even_price break_even_price
     *
     * @return $this
     */
    public function setBreakEvenPrice($break_even_price)
    {
        $this->container['break_even_price'] = $break_even_price;

        return $this;
    }

    /**
     * Gets margin_call_price
     *
     * @return double
     */
    public function getMarginCallPrice()
    {
        return $this->container['margin_call_price'];
    }

    /**
     * Sets margin_call_price
     *
     * @param double $margin_call_price margin_call_price
     *
     * @return $this
     */
    public function setMarginCallPrice($margin_call_price)
    {
        $this->container['margin_call_price'] = $margin_call_price;

        return $this;
    }

    /**
     * Gets liquidation_price
     *
     * @return double
     */
    public function getLiquidationPrice()
    {
        return $this->container['liquidation_price'];
    }

    /**
     * Sets liquidation_price
     *
     * @param double $liquidation_price liquidation_price
     *
     * @return $this
     */
    public function setLiquidationPrice($liquidation_price)
    {
        $this->container['liquidation_price'] = $liquidation_price;

        return $this;
    }

    /**
     * Gets bankrupt_price
     *
     * @return double
     */
    public function getBankruptPrice()
    {
        return $this->container['bankrupt_price'];
    }

    /**
     * Sets bankrupt_price
     *
     * @param double $bankrupt_price bankrupt_price
     *
     * @return $this
     */
    public function setBankruptPrice($bankrupt_price)
    {
        $this->container['bankrupt_price'] = $bankrupt_price;

        return $this;
    }

    /**
     * Gets timestamp
     *
     * @return \DateTime
     */
    public function getTimestamp()
    {
        return $this->container['timestamp'];
    }

    /**
     * Sets timestamp
     *
     * @param \DateTime $timestamp timestamp
     *
     * @return $this
     */
    public function setTimestamp($timestamp)
    {
        $this->container['timestamp'] = $timestamp;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


