diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..9c79484 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,24 @@ +setUsingCache(true) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setRiskyAllowed(true) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/README.md b/README.md index 5b57072..fd1eccd 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ APIv4 provides spot, margin and futures trading operations. There are public API This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 4.21.2 -- Package version: 5.21.2 +- API version: 4.40.0 +- Package version: 5.40.0 - Build package: org.openapitools.codegen.languages.PhpClientCodegen For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts) @@ -122,17 +122,24 @@ Class | Method | HTTP request | Description *DeliveryApi* | [**listPriceTriggeredDeliveryOrders**](docs/Api/DeliveryApi.md#listpricetriggereddeliveryorders) | **GET** /delivery/{settle}/price_orders | List all auto orders *DeliveryApi* | [**createPriceTriggeredDeliveryOrder**](docs/Api/DeliveryApi.md#createpricetriggereddeliveryorder) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order *DeliveryApi* | [**cancelPriceTriggeredDeliveryOrderList**](docs/Api/DeliveryApi.md#cancelpricetriggereddeliveryorderlist) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders -*DeliveryApi* | [**getPriceTriggeredDeliveryOrder**](docs/Api/DeliveryApi.md#getpricetriggereddeliveryorder) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order -*DeliveryApi* | [**cancelPriceTriggeredDeliveryOrder**](docs/Api/DeliveryApi.md#cancelpricetriggereddeliveryorder) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order +*DeliveryApi* | [**getPriceTriggeredDeliveryOrder**](docs/Api/DeliveryApi.md#getpricetriggereddeliveryorder) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a price-triggered order +*DeliveryApi* | [**cancelPriceTriggeredDeliveryOrder**](docs/Api/DeliveryApi.md#cancelpricetriggereddeliveryorder) | **DELETE** /delivery/{settle}/price_orders/{order_id} | cancel a price-triggered order +*FlashSwapApi* | [**listFlashSwapCurrencies**](docs/Api/FlashSwapApi.md#listflashswapcurrencies) | **GET** /flash_swap/currencies | List all supported currencies in flash swap +*FlashSwapApi* | [**listFlashSwapOrders**](docs/Api/FlashSwapApi.md#listflashswaporders) | **GET** /flash_swap/orders | List all flash swap orders +*FlashSwapApi* | [**createFlashSwapOrder**](docs/Api/FlashSwapApi.md#createflashswaporder) | **POST** /flash_swap/orders | Create a flash swap order +*FlashSwapApi* | [**getFlashSwapOrder**](docs/Api/FlashSwapApi.md#getflashswaporder) | **GET** /flash_swap/orders/{order_id} | Get a single flash swap order's detail +*FlashSwapApi* | [**previewFlashSwapOrder**](docs/Api/FlashSwapApi.md#previewflashswaporder) | **POST** /flash_swap/orders/preview | Initiate a flash swap order preview *FuturesApi* | [**listFuturesContracts**](docs/Api/FuturesApi.md#listfuturescontracts) | **GET** /futures/{settle}/contracts | List all futures contracts *FuturesApi* | [**getFuturesContract**](docs/Api/FuturesApi.md#getfuturescontract) | **GET** /futures/{settle}/contracts/{contract} | Get a single contract *FuturesApi* | [**listFuturesOrderBook**](docs/Api/FuturesApi.md#listfuturesorderbook) | **GET** /futures/{settle}/order_book | Futures order book *FuturesApi* | [**listFuturesTrades**](docs/Api/FuturesApi.md#listfuturestrades) | **GET** /futures/{settle}/trades | Futures trading history *FuturesApi* | [**listFuturesCandlesticks**](docs/Api/FuturesApi.md#listfuturescandlesticks) | **GET** /futures/{settle}/candlesticks | Get futures candlesticks +*FuturesApi* | [**listFuturesPremiumIndex**](docs/Api/FuturesApi.md#listfuturespremiumindex) | **GET** /futures/{settle}/premium_index | Premium Index K-Line *FuturesApi* | [**listFuturesTickers**](docs/Api/FuturesApi.md#listfuturestickers) | **GET** /futures/{settle}/tickers | List futures tickers *FuturesApi* | [**listFuturesFundingRateHistory**](docs/Api/FuturesApi.md#listfuturesfundingratehistory) | **GET** /futures/{settle}/funding_rate | Funding rate history *FuturesApi* | [**listFuturesInsuranceLedger**](docs/Api/FuturesApi.md#listfuturesinsuranceledger) | **GET** /futures/{settle}/insurance | Futures insurance balance history *FuturesApi* | [**listContractStats**](docs/Api/FuturesApi.md#listcontractstats) | **GET** /futures/{settle}/contract_stats | Futures stats +*FuturesApi* | [**getIndexConstituents**](docs/Api/FuturesApi.md#getindexconstituents) | **GET** /futures/{settle}/index_constituents/{index} | Get index constituents *FuturesApi* | [**listLiquidatedOrders**](docs/Api/FuturesApi.md#listliquidatedorders) | **GET** /futures/{settle}/liq_orders | Retrieve liquidation history *FuturesApi* | [**listFuturesAccounts**](docs/Api/FuturesApi.md#listfuturesaccounts) | **GET** /futures/{settle}/accounts | Query futures account *FuturesApi* | [**listFuturesAccountBook**](docs/Api/FuturesApi.md#listfuturesaccountbook) | **GET** /futures/{settle}/account_book | Query account book @@ -149,16 +156,21 @@ Class | Method | HTTP request | Description *FuturesApi* | [**listFuturesOrders**](docs/Api/FuturesApi.md#listfuturesorders) | **GET** /futures/{settle}/orders | List futures orders *FuturesApi* | [**createFuturesOrder**](docs/Api/FuturesApi.md#createfuturesorder) | **POST** /futures/{settle}/orders | Create a futures order *FuturesApi* | [**cancelFuturesOrders**](docs/Api/FuturesApi.md#cancelfuturesorders) | **DELETE** /futures/{settle}/orders | Cancel all `open` orders matched +*FuturesApi* | [**createBatchFuturesOrder**](docs/Api/FuturesApi.md#createbatchfuturesorder) | **POST** /futures/{settle}/batch_orders | Create a batch of futures orders *FuturesApi* | [**getFuturesOrder**](docs/Api/FuturesApi.md#getfuturesorder) | **GET** /futures/{settle}/orders/{order_id} | Get a single order +*FuturesApi* | [**amendFuturesOrder**](docs/Api/FuturesApi.md#amendfuturesorder) | **PUT** /futures/{settle}/orders/{order_id} | Amend an order *FuturesApi* | [**cancelFuturesOrder**](docs/Api/FuturesApi.md#cancelfuturesorder) | **DELETE** /futures/{settle}/orders/{order_id} | Cancel a single order *FuturesApi* | [**getMyTrades**](docs/Api/FuturesApi.md#getmytrades) | **GET** /futures/{settle}/my_trades | List personal trading history +*FuturesApi* | [**getMyTradesWithTimeRange**](docs/Api/FuturesApi.md#getmytradeswithtimerange) | **GET** /futures/{settle}/my_trades_timerange | List personal trading history by time range *FuturesApi* | [**listPositionClose**](docs/Api/FuturesApi.md#listpositionclose) | **GET** /futures/{settle}/position_close | List position close history *FuturesApi* | [**listLiquidates**](docs/Api/FuturesApi.md#listliquidates) | **GET** /futures/{settle}/liquidates | List liquidation history +*FuturesApi* | [**listAutoDeleverages**](docs/Api/FuturesApi.md#listautodeleverages) | **GET** /futures/{settle}/auto_deleverages | List Auto-Deleveraging History +*FuturesApi* | [**countdownCancelAllFutures**](docs/Api/FuturesApi.md#countdowncancelallfutures) | **POST** /futures/{settle}/countdown_cancel_all | Countdown cancel orders *FuturesApi* | [**listPriceTriggeredOrders**](docs/Api/FuturesApi.md#listpricetriggeredorders) | **GET** /futures/{settle}/price_orders | List all auto orders *FuturesApi* | [**createPriceTriggeredOrder**](docs/Api/FuturesApi.md#createpricetriggeredorder) | **POST** /futures/{settle}/price_orders | Create a price-triggered order *FuturesApi* | [**cancelPriceTriggeredOrderList**](docs/Api/FuturesApi.md#cancelpricetriggeredorderlist) | **DELETE** /futures/{settle}/price_orders | Cancel all open orders -*FuturesApi* | [**getPriceTriggeredOrder**](docs/Api/FuturesApi.md#getpricetriggeredorder) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order -*FuturesApi* | [**cancelPriceTriggeredOrder**](docs/Api/FuturesApi.md#cancelpricetriggeredorder) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order +*FuturesApi* | [**getPriceTriggeredOrder**](docs/Api/FuturesApi.md#getpricetriggeredorder) | **GET** /futures/{settle}/price_orders/{order_id} | Get a price-triggered order +*FuturesApi* | [**cancelPriceTriggeredOrder**](docs/Api/FuturesApi.md#cancelpricetriggeredorder) | **DELETE** /futures/{settle}/price_orders/{order_id} | cancel a price-triggered order *MarginApi* | [**listMarginCurrencyPairs**](docs/Api/MarginApi.md#listmargincurrencypairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading *MarginApi* | [**getMarginCurrencyPair**](docs/Api/MarginApi.md#getmargincurrencypair) | **GET** /margin/currency_pairs/{currency_pair} | Query one single margin currency pair *MarginApi* | [**listFundingBook**](docs/Api/MarginApi.md#listfundingbook) | **GET** /margin/funding_book | Order book of lending loans @@ -173,120 +185,227 @@ Class | Method | HTTP request | Description *MarginApi* | [**updateLoan**](docs/Api/MarginApi.md#updateloan) | **PATCH** /margin/loans/{loan_id} | Modify a loan *MarginApi* | [**listLoanRepayments**](docs/Api/MarginApi.md#listloanrepayments) | **GET** /margin/loans/{loan_id}/repayment | List loan repayment records *MarginApi* | [**repayLoan**](docs/Api/MarginApi.md#repayloan) | **POST** /margin/loans/{loan_id}/repayment | Repay a loan -*MarginApi* | [**listLoanRecords**](docs/Api/MarginApi.md#listloanrecords) | **GET** /margin/loan_records | List repayment records of specified loan +*MarginApi* | [**listLoanRecords**](docs/Api/MarginApi.md#listloanrecords) | **GET** /margin/loan_records | List repayment records of a specific loan *MarginApi* | [**getLoanRecord**](docs/Api/MarginApi.md#getloanrecord) | **GET** /margin/loan_records/{loan_record_id} | Get one single loan record *MarginApi* | [**updateLoanRecord**](docs/Api/MarginApi.md#updateloanrecord) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record *MarginApi* | [**getAutoRepayStatus**](docs/Api/MarginApi.md#getautorepaystatus) | **GET** /margin/auto_repay | Retrieve user auto repayment setting *MarginApi* | [**setAutoRepay**](docs/Api/MarginApi.md#setautorepay) | **POST** /margin/auto_repay | Update user's auto repayment setting +*MarginApi* | [**getMarginTransferable**](docs/Api/MarginApi.md#getmargintransferable) | **GET** /margin/transferable | Get the max transferable amount for a specific margin currency +*MarginApi* | [**getMarginBorrowable**](docs/Api/MarginApi.md#getmarginborrowable) | **GET** /margin/borrowable | Get the max borrowable amount for a specific margin currency *MarginApi* | [**listCrossMarginCurrencies**](docs/Api/MarginApi.md#listcrossmargincurrencies) | **GET** /margin/cross/currencies | Currencies supported by cross margin. *MarginApi* | [**getCrossMarginCurrency**](docs/Api/MarginApi.md#getcrossmargincurrency) | **GET** /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin *MarginApi* | [**getCrossMarginAccount**](docs/Api/MarginApi.md#getcrossmarginaccount) | **GET** /margin/cross/accounts | Retrieve cross margin account +*MarginApi* | [**listCrossMarginAccountBook**](docs/Api/MarginApi.md#listcrossmarginaccountbook) | **GET** /margin/cross/account_book | Retrieve cross margin account change history *MarginApi* | [**listCrossMarginLoans**](docs/Api/MarginApi.md#listcrossmarginloans) | **GET** /margin/cross/loans | List cross margin borrow history *MarginApi* | [**createCrossMarginLoan**](docs/Api/MarginApi.md#createcrossmarginloan) | **POST** /margin/cross/loans | Create a cross margin borrow loan *MarginApi* | [**getCrossMarginLoan**](docs/Api/MarginApi.md#getcrossmarginloan) | **GET** /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail *MarginApi* | [**listCrossMarginRepayments**](docs/Api/MarginApi.md#listcrossmarginrepayments) | **GET** /margin/cross/repayments | Retrieve cross margin repayments -*MarginApi* | [**repayCrossMarginLoan**](docs/Api/MarginApi.md#repaycrossmarginloan) | **POST** /margin/cross/repayments | Repay cross margin loan -*SpotApi* | [**listCurrencies**](docs/Api/SpotApi.md#listcurrencies) | **GET** /spot/currencies | List all currencies' detail -*SpotApi* | [**getCurrency**](docs/Api/SpotApi.md#getcurrency) | **GET** /spot/currencies/{currency} | Get detail of one particular currency +*MarginApi* | [**repayCrossMarginLoan**](docs/Api/MarginApi.md#repaycrossmarginloan) | **POST** /margin/cross/repayments | Cross margin repayments +*MarginApi* | [**getCrossMarginTransferable**](docs/Api/MarginApi.md#getcrossmargintransferable) | **GET** /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency +*MarginApi* | [**getCrossMarginBorrowable**](docs/Api/MarginApi.md#getcrossmarginborrowable) | **GET** /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency +*OptionsApi* | [**listOptionsUnderlyings**](docs/Api/OptionsApi.md#listoptionsunderlyings) | **GET** /options/underlyings | List all underlyings +*OptionsApi* | [**listOptionsExpirations**](docs/Api/OptionsApi.md#listoptionsexpirations) | **GET** /options/expirations | List all expiration times +*OptionsApi* | [**listOptionsContracts**](docs/Api/OptionsApi.md#listoptionscontracts) | **GET** /options/contracts | List all the contracts with specified underlying and expiration time +*OptionsApi* | [**getOptionsContract**](docs/Api/OptionsApi.md#getoptionscontract) | **GET** /options/contracts/{contract} | Query specified contract detail +*OptionsApi* | [**listOptionsSettlements**](docs/Api/OptionsApi.md#listoptionssettlements) | **GET** /options/settlements | List settlement history +*OptionsApi* | [**getOptionsSettlement**](docs/Api/OptionsApi.md#getoptionssettlement) | **GET** /options/settlements/{contract} | Get specified contract's settlement +*OptionsApi* | [**listMyOptionsSettlements**](docs/Api/OptionsApi.md#listmyoptionssettlements) | **GET** /options/my_settlements | List my options settlements +*OptionsApi* | [**listOptionsOrderBook**](docs/Api/OptionsApi.md#listoptionsorderbook) | **GET** /options/order_book | Options order book +*OptionsApi* | [**listOptionsTickers**](docs/Api/OptionsApi.md#listoptionstickers) | **GET** /options/tickers | List tickers of options contracts +*OptionsApi* | [**listOptionsUnderlyingTickers**](docs/Api/OptionsApi.md#listoptionsunderlyingtickers) | **GET** /options/underlying/tickers/{underlying} | Get underlying ticker +*OptionsApi* | [**listOptionsCandlesticks**](docs/Api/OptionsApi.md#listoptionscandlesticks) | **GET** /options/candlesticks | Get options candlesticks +*OptionsApi* | [**listOptionsUnderlyingCandlesticks**](docs/Api/OptionsApi.md#listoptionsunderlyingcandlesticks) | **GET** /options/underlying/candlesticks | Mark price candlesticks of an underlying +*OptionsApi* | [**listOptionsTrades**](docs/Api/OptionsApi.md#listoptionstrades) | **GET** /options/trades | Options trade history +*OptionsApi* | [**listOptionsAccount**](docs/Api/OptionsApi.md#listoptionsaccount) | **GET** /options/accounts | List options account +*OptionsApi* | [**listOptionsAccountBook**](docs/Api/OptionsApi.md#listoptionsaccountbook) | **GET** /options/account_book | List account changing history +*OptionsApi* | [**listOptionsPositions**](docs/Api/OptionsApi.md#listoptionspositions) | **GET** /options/positions | List user's positions of specified underlying +*OptionsApi* | [**getOptionsPosition**](docs/Api/OptionsApi.md#getoptionsposition) | **GET** /options/positions/{contract} | Get specified contract position +*OptionsApi* | [**listOptionsPositionClose**](docs/Api/OptionsApi.md#listoptionspositionclose) | **GET** /options/position_close | List user's liquidation history of specified underlying +*OptionsApi* | [**listOptionsOrders**](docs/Api/OptionsApi.md#listoptionsorders) | **GET** /options/orders | List options orders +*OptionsApi* | [**createOptionsOrder**](docs/Api/OptionsApi.md#createoptionsorder) | **POST** /options/orders | Create an options order +*OptionsApi* | [**cancelOptionsOrders**](docs/Api/OptionsApi.md#canceloptionsorders) | **DELETE** /options/orders | Cancel all `open` orders matched +*OptionsApi* | [**getOptionsOrder**](docs/Api/OptionsApi.md#getoptionsorder) | **GET** /options/orders/{order_id} | Get a single order +*OptionsApi* | [**cancelOptionsOrder**](docs/Api/OptionsApi.md#canceloptionsorder) | **DELETE** /options/orders/{order_id} | Cancel a single order +*OptionsApi* | [**listMyOptionsTrades**](docs/Api/OptionsApi.md#listmyoptionstrades) | **GET** /options/my_trades | List personal trading history +*RebateApi* | [**agencyTransactionHistory**](docs/Api/RebateApi.md#agencytransactionhistory) | **GET** /rebate/agency/transaction_history | The broker obtains the transaction history of the recommended user +*RebateApi* | [**agencyCommissionsHistory**](docs/Api/RebateApi.md#agencycommissionshistory) | **GET** /rebate/agency/commission_history | The broker obtains the commission history of the recommended user +*SpotApi* | [**listCurrencies**](docs/Api/SpotApi.md#listcurrencies) | **GET** /spot/currencies | List all currencies' details +*SpotApi* | [**getCurrency**](docs/Api/SpotApi.md#getcurrency) | **GET** /spot/currencies/{currency} | Get details of a specific currency *SpotApi* | [**listCurrencyPairs**](docs/Api/SpotApi.md#listcurrencypairs) | **GET** /spot/currency_pairs | List all currency pairs supported -*SpotApi* | [**getCurrencyPair**](docs/Api/SpotApi.md#getcurrencypair) | **GET** /spot/currency_pairs/{currency_pair} | Get detail of one single order +*SpotApi* | [**getCurrencyPair**](docs/Api/SpotApi.md#getcurrencypair) | **GET** /spot/currency_pairs/{currency_pair} | Get details of a specifc currency pair *SpotApi* | [**listTickers**](docs/Api/SpotApi.md#listtickers) | **GET** /spot/tickers | Retrieve ticker information *SpotApi* | [**listOrderBook**](docs/Api/SpotApi.md#listorderbook) | **GET** /spot/order_book | Retrieve order book *SpotApi* | [**listTrades**](docs/Api/SpotApi.md#listtrades) | **GET** /spot/trades | Retrieve market trades *SpotApi* | [**listCandlesticks**](docs/Api/SpotApi.md#listcandlesticks) | **GET** /spot/candlesticks | Market candlesticks *SpotApi* | [**getFee**](docs/Api/SpotApi.md#getfee) | **GET** /spot/fee | Query user trading fee rates +*SpotApi* | [**getBatchSpotFee**](docs/Api/SpotApi.md#getbatchspotfee) | **GET** /spot/batch_fee | Query a batch of user trading fee rates *SpotApi* | [**listSpotAccounts**](docs/Api/SpotApi.md#listspotaccounts) | **GET** /spot/accounts | List spot accounts *SpotApi* | [**createBatchOrders**](docs/Api/SpotApi.md#createbatchorders) | **POST** /spot/batch_orders | Create a batch of orders *SpotApi* | [**listAllOpenOrders**](docs/Api/SpotApi.md#listallopenorders) | **GET** /spot/open_orders | List all open orders +*SpotApi* | [**createCrossLiquidateOrder**](docs/Api/SpotApi.md#createcrossliquidateorder) | **POST** /spot/cross_liquidate_orders | close position when cross-currency is disabled *SpotApi* | [**listOrders**](docs/Api/SpotApi.md#listorders) | **GET** /spot/orders | List orders *SpotApi* | [**createOrder**](docs/Api/SpotApi.md#createorder) | **POST** /spot/orders | Create an order *SpotApi* | [**cancelOrders**](docs/Api/SpotApi.md#cancelorders) | **DELETE** /spot/orders | Cancel all `open` orders in specified currency pair *SpotApi* | [**cancelBatchOrders**](docs/Api/SpotApi.md#cancelbatchorders) | **POST** /spot/cancel_batch_orders | Cancel a batch of orders with an ID list *SpotApi* | [**getOrder**](docs/Api/SpotApi.md#getorder) | **GET** /spot/orders/{order_id} | Get a single order *SpotApi* | [**cancelOrder**](docs/Api/SpotApi.md#cancelorder) | **DELETE** /spot/orders/{order_id} | Cancel a single order +*SpotApi* | [**amendOrder**](docs/Api/SpotApi.md#amendorder) | **PATCH** /spot/orders/{order_id} | Amend an order *SpotApi* | [**listMyTrades**](docs/Api/SpotApi.md#listmytrades) | **GET** /spot/my_trades | List personal trading history +*SpotApi* | [**getSystemTime**](docs/Api/SpotApi.md#getsystemtime) | **GET** /spot/time | Get server current time +*SpotApi* | [**countdownCancelAllSpot**](docs/Api/SpotApi.md#countdowncancelallspot) | **POST** /spot/countdown_cancel_all | Countdown cancel orders *SpotApi* | [**listSpotPriceTriggeredOrders**](docs/Api/SpotApi.md#listspotpricetriggeredorders) | **GET** /spot/price_orders | Retrieve running auto order list *SpotApi* | [**createSpotPriceTriggeredOrder**](docs/Api/SpotApi.md#createspotpricetriggeredorder) | **POST** /spot/price_orders | Create a price-triggered order *SpotApi* | [**cancelSpotPriceTriggeredOrderList**](docs/Api/SpotApi.md#cancelspotpricetriggeredorderlist) | **DELETE** /spot/price_orders | Cancel all open orders -*SpotApi* | [**getSpotPriceTriggeredOrder**](docs/Api/SpotApi.md#getspotpricetriggeredorder) | **GET** /spot/price_orders/{order_id} | Get a single order -*SpotApi* | [**cancelSpotPriceTriggeredOrder**](docs/Api/SpotApi.md#cancelspotpricetriggeredorder) | **DELETE** /spot/price_orders/{order_id} | Cancel a single order +*SpotApi* | [**getSpotPriceTriggeredOrder**](docs/Api/SpotApi.md#getspotpricetriggeredorder) | **GET** /spot/price_orders/{order_id} | Get a price-triggered order +*SpotApi* | [**cancelSpotPriceTriggeredOrder**](docs/Api/SpotApi.md#cancelspotpricetriggeredorder) | **DELETE** /spot/price_orders/{order_id} | cancel a price-triggered order +*SubAccountApi* | [**listSubAccounts**](docs/Api/SubAccountApi.md#listsubaccounts) | **GET** /sub_accounts | List sub-accounts +*SubAccountApi* | [**createSubAccounts**](docs/Api/SubAccountApi.md#createsubaccounts) | **POST** /sub_accounts | Create a new sub-account +*SubAccountApi* | [**getSubAccount**](docs/Api/SubAccountApi.md#getsubaccount) | **GET** /sub_accounts/{user_id} | Get the sub-account +*SubAccountApi* | [**listSubAccountKeys**](docs/Api/SubAccountApi.md#listsubaccountkeys) | **GET** /sub_accounts/{user_id}/keys | List all API Key of the sub-account +*SubAccountApi* | [**createSubAccountKeys**](docs/Api/SubAccountApi.md#createsubaccountkeys) | **POST** /sub_accounts/{user_id}/keys | Create API Key of the sub-account +*SubAccountApi* | [**getSubAccountKey**](docs/Api/SubAccountApi.md#getsubaccountkey) | **GET** /sub_accounts/{user_id}/keys/{key} | Get the API Key of the sub-account +*SubAccountApi* | [**updateSubAccountKeys**](docs/Api/SubAccountApi.md#updatesubaccountkeys) | **PUT** /sub_accounts/{user_id}/keys/{key} | Update API key of the sub-account +*SubAccountApi* | [**deleteSubAccountKeys**](docs/Api/SubAccountApi.md#deletesubaccountkeys) | **DELETE** /sub_accounts/{user_id}/keys/{key} | Delete API key of the sub-account +*SubAccountApi* | [**lockSubAccount**](docs/Api/SubAccountApi.md#locksubaccount) | **POST** /sub_accounts/{user_id}/lock | Lock the sub-account +*SubAccountApi* | [**unlockSubAccount**](docs/Api/SubAccountApi.md#unlocksubaccount) | **POST** /sub_accounts/{user_id}/unlock | Unlock the sub-account +*WalletApi* | [**listCurrencyChains**](docs/Api/WalletApi.md#listcurrencychains) | **GET** /wallet/currency_chains | List chains supported for specified currency *WalletApi* | [**getDepositAddress**](docs/Api/WalletApi.md#getdepositaddress) | **GET** /wallet/deposit_address | Generate currency deposit address *WalletApi* | [**listWithdrawals**](docs/Api/WalletApi.md#listwithdrawals) | **GET** /wallet/withdrawals | Retrieve withdrawal records *WalletApi* | [**listDeposits**](docs/Api/WalletApi.md#listdeposits) | **GET** /wallet/deposits | Retrieve deposit records *WalletApi* | [**transfer**](docs/Api/WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between trading accounts -*WalletApi* | [**listSubAccountTransfers**](docs/Api/WalletApi.md#listsubaccounttransfers) | **GET** /wallet/sub_account_transfers | Transfer records between main and sub accounts +*WalletApi* | [**listSubAccountTransfers**](docs/Api/WalletApi.md#listsubaccounttransfers) | **GET** /wallet/sub_account_transfers | Retrieve transfer records between main and sub accounts *WalletApi* | [**transferWithSubAccount**](docs/Api/WalletApi.md#transferwithsubaccount) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts +*WalletApi* | [**subAccountToSubAccount**](docs/Api/WalletApi.md#subaccounttosubaccount) | **POST** /wallet/sub_account_to_sub_account | Sub-account transfers to sub-account *WalletApi* | [**listWithdrawStatus**](docs/Api/WalletApi.md#listwithdrawstatus) | **GET** /wallet/withdraw_status | Retrieve withdrawal status *WalletApi* | [**listSubAccountBalances**](docs/Api/WalletApi.md#listsubaccountbalances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances +*WalletApi* | [**listSubAccountMarginBalances**](docs/Api/WalletApi.md#listsubaccountmarginbalances) | **GET** /wallet/sub_account_margin_balances | Query sub accounts' margin balances +*WalletApi* | [**listSubAccountFuturesBalances**](docs/Api/WalletApi.md#listsubaccountfuturesbalances) | **GET** /wallet/sub_account_futures_balances | Query sub accounts' futures account balances +*WalletApi* | [**listSubAccountCrossMarginBalances**](docs/Api/WalletApi.md#listsubaccountcrossmarginbalances) | **GET** /wallet/sub_account_cross_margin_balances | Query subaccount's cross_margin account info +*WalletApi* | [**listSavedAddress**](docs/Api/WalletApi.md#listsavedaddress) | **GET** /wallet/saved_address | Query saved address *WalletApi* | [**getTradeFee**](docs/Api/WalletApi.md#gettradefee) | **GET** /wallet/fee | Retrieve personal trading fee +*WalletApi* | [**getTotalBalance**](docs/Api/WalletApi.md#gettotalbalance) | **GET** /wallet/total_balance | Retrieve user's total balances *WithdrawalApi* | [**withdraw**](docs/Api/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw *WithdrawalApi* | [**cancelWithdrawal**](docs/Api/WithdrawalApi.md#cancelwithdrawal) | **DELETE** /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID ## Documentation For Models + - [AccountBalance](docs/Model/AccountBalance.md) + - [AgencyCommission](docs/Model/AgencyCommission.md) + - [AgencyCommissionHistory](docs/Model/AgencyCommissionHistory.md) + - [AgencyTransaction](docs/Model/AgencyTransaction.md) + - [AgencyTransactionHistory](docs/Model/AgencyTransactionHistory.md) + - [ApiV4KeyPerm](docs/Model/ApiV4KeyPerm.md) - [AutoRepaySetting](docs/Model/AutoRepaySetting.md) + - [BatchFuturesOrder](docs/Model/BatchFuturesOrder.md) - [BatchOrder](docs/Model/BatchOrder.md) - [CancelOrder](docs/Model/CancelOrder.md) - [CancelOrderResult](docs/Model/CancelOrderResult.md) - [Contract](docs/Model/Contract.md) - [ContractStat](docs/Model/ContractStat.md) + - [CountdownCancelAllFuturesTask](docs/Model/CountdownCancelAllFuturesTask.md) + - [CountdownCancelAllSpotTask](docs/Model/CountdownCancelAllSpotTask.md) - [CrossMarginAccount](docs/Model/CrossMarginAccount.md) + - [CrossMarginAccountBook](docs/Model/CrossMarginAccountBook.md) - [CrossMarginBalance](docs/Model/CrossMarginBalance.md) + - [CrossMarginBorrowable](docs/Model/CrossMarginBorrowable.md) - [CrossMarginCurrency](docs/Model/CrossMarginCurrency.md) - [CrossMarginLoan](docs/Model/CrossMarginLoan.md) - [CrossMarginRepayRequest](docs/Model/CrossMarginRepayRequest.md) - [CrossMarginRepayment](docs/Model/CrossMarginRepayment.md) + - [CrossMarginTransferable](docs/Model/CrossMarginTransferable.md) - [Currency](docs/Model/Currency.md) + - [CurrencyChain](docs/Model/CurrencyChain.md) - [CurrencyPair](docs/Model/CurrencyPair.md) - [DeliveryContract](docs/Model/DeliveryContract.md) - [DeliverySettlement](docs/Model/DeliverySettlement.md) - [DepositAddress](docs/Model/DepositAddress.md) + - [FlashSwapCurrency](docs/Model/FlashSwapCurrency.md) + - [FlashSwapOrder](docs/Model/FlashSwapOrder.md) + - [FlashSwapOrderPreview](docs/Model/FlashSwapOrderPreview.md) + - [FlashSwapOrderRequest](docs/Model/FlashSwapOrderRequest.md) - [FundingAccount](docs/Model/FundingAccount.md) - [FundingBookItem](docs/Model/FundingBookItem.md) - [FundingRateRecord](docs/Model/FundingRateRecord.md) - [FuturesAccount](docs/Model/FuturesAccount.md) - [FuturesAccountBook](docs/Model/FuturesAccountBook.md) + - [FuturesAccountHistory](docs/Model/FuturesAccountHistory.md) + - [FuturesAutoDeleverage](docs/Model/FuturesAutoDeleverage.md) - [FuturesCandlestick](docs/Model/FuturesCandlestick.md) + - [FuturesIndexConstituents](docs/Model/FuturesIndexConstituents.md) - [FuturesInitialOrder](docs/Model/FuturesInitialOrder.md) - [FuturesLiquidate](docs/Model/FuturesLiquidate.md) - [FuturesOrder](docs/Model/FuturesOrder.md) + - [FuturesOrderAmendment](docs/Model/FuturesOrderAmendment.md) - [FuturesOrderBook](docs/Model/FuturesOrderBook.md) - [FuturesOrderBookItem](docs/Model/FuturesOrderBookItem.md) + - [FuturesPremiumIndex](docs/Model/FuturesPremiumIndex.md) - [FuturesPriceTrigger](docs/Model/FuturesPriceTrigger.md) - [FuturesPriceTriggeredOrder](docs/Model/FuturesPriceTriggeredOrder.md) - [FuturesTicker](docs/Model/FuturesTicker.md) - [FuturesTrade](docs/Model/FuturesTrade.md) + - [IndexConstituent](docs/Model/IndexConstituent.md) - [InsuranceRecord](docs/Model/InsuranceRecord.md) - [LedgerRecord](docs/Model/LedgerRecord.md) + - [LiquidateOrder](docs/Model/LiquidateOrder.md) - [Loan](docs/Model/Loan.md) - [LoanPatch](docs/Model/LoanPatch.md) - [LoanRecord](docs/Model/LoanRecord.md) - [MarginAccount](docs/Model/MarginAccount.md) - [MarginAccountBook](docs/Model/MarginAccountBook.md) - [MarginAccountCurrency](docs/Model/MarginAccountCurrency.md) + - [MarginBorrowable](docs/Model/MarginBorrowable.md) - [MarginCurrencyPair](docs/Model/MarginCurrencyPair.md) + - [MarginTransferable](docs/Model/MarginTransferable.md) - [MultiChainAddressItem](docs/Model/MultiChainAddressItem.md) - [MyFuturesTrade](docs/Model/MyFuturesTrade.md) - [OpenOrders](docs/Model/OpenOrders.md) + - [OptionsAccount](docs/Model/OptionsAccount.md) + - [OptionsAccountBook](docs/Model/OptionsAccountBook.md) + - [OptionsCandlestick](docs/Model/OptionsCandlestick.md) + - [OptionsContract](docs/Model/OptionsContract.md) + - [OptionsMySettlements](docs/Model/OptionsMySettlements.md) + - [OptionsMyTrade](docs/Model/OptionsMyTrade.md) + - [OptionsOrder](docs/Model/OptionsOrder.md) + - [OptionsPosition](docs/Model/OptionsPosition.md) + - [OptionsPositionClose](docs/Model/OptionsPositionClose.md) + - [OptionsPositionCloseOrder](docs/Model/OptionsPositionCloseOrder.md) + - [OptionsSettlement](docs/Model/OptionsSettlement.md) + - [OptionsTicker](docs/Model/OptionsTicker.md) + - [OptionsUnderlying](docs/Model/OptionsUnderlying.md) + - [OptionsUnderlyingTicker](docs/Model/OptionsUnderlyingTicker.md) - [Order](docs/Model/Order.md) - [OrderBook](docs/Model/OrderBook.md) + - [OrderPatch](docs/Model/OrderPatch.md) - [Position](docs/Model/Position.md) - [PositionClose](docs/Model/PositionClose.md) - [PositionCloseOrder](docs/Model/PositionCloseOrder.md) - [RepayRequest](docs/Model/RepayRequest.md) - [Repayment](docs/Model/Repayment.md) + - [SavedAddress](docs/Model/SavedAddress.md) - [SpotAccount](docs/Model/SpotAccount.md) + - [SpotFee](docs/Model/SpotFee.md) - [SpotPricePutOrder](docs/Model/SpotPricePutOrder.md) - [SpotPriceTrigger](docs/Model/SpotPriceTrigger.md) - [SpotPriceTriggeredOrder](docs/Model/SpotPriceTriggeredOrder.md) + - [SubAccount](docs/Model/SubAccount.md) - [SubAccountBalance](docs/Model/SubAccountBalance.md) + - [SubAccountCrossMarginBalance](docs/Model/SubAccountCrossMarginBalance.md) + - [SubAccountFuturesBalance](docs/Model/SubAccountFuturesBalance.md) + - [SubAccountKey](docs/Model/SubAccountKey.md) + - [SubAccountMarginBalance](docs/Model/SubAccountMarginBalance.md) + - [SubAccountToSubAccount](docs/Model/SubAccountToSubAccount.md) - [SubAccountTransfer](docs/Model/SubAccountTransfer.md) + - [SubCrossMarginAccount](docs/Model/SubCrossMarginAccount.md) + - [SystemTime](docs/Model/SystemTime.md) - [Ticker](docs/Model/Ticker.md) + - [TotalBalance](docs/Model/TotalBalance.md) - [Trade](docs/Model/Trade.md) - [TradeFee](docs/Model/TradeFee.md) + - [TransactionID](docs/Model/TransactionID.md) - [Transfer](docs/Model/Transfer.md) - [TriggerOrderResponse](docs/Model/TriggerOrderResponse.md) + - [TriggerTime](docs/Model/TriggerTime.md) - [WithdrawStatus](docs/Model/WithdrawStatus.md) diff --git a/composer.json b/composer.json index cf065ac..fa9a2ec 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "gateio/gateapi-php", - "version": "5.21.2", + "version": "5.40.0", "description": "Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf.", "keywords": [ "gate", @@ -29,8 +29,8 @@ }, "require-dev": { "phpunit/phpunit": "^7.4", - "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~2.14" + "squizlabs/php_codesniffer": "~3.6", + "friendsofphp/php-cs-fixer": "~2.17" }, "autoload": { "psr-4": { "GateApi\\" : "src/" } diff --git a/composer.lock b/composer.lock index fa78f6d..03966bc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,34 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f958b6eba0c444b82e2d03ad96889b48", + "content-hash": "27d781340b451b2d0c53c529f5417336", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.5.5", + "version": "6.5.8", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981", + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981", + "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", + "guzzlehttp/psr7": "^1.9", "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" + "symfony/polyfill-intl-idn": "^1.17" }, "require-dev": { "ext-curl": "*", @@ -48,22 +42,52 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", @@ -79,29 +103,37 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/6.5" + "source": "https://github.com/guzzle/guzzle/tree/6.5.8" }, - "time": "2020-06-16T21:01:06+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2022-06-20T22:16:07+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.4.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" + "reference": "b94b2807d85443f9719887892882d0329d1e2598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", + "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "shasum": "" }, "require": { "php": ">=5.5" @@ -112,26 +144,41 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", @@ -140,29 +187,37 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.4.1" + "source": "https://github.com/guzzle/promises/tree/1.5.2" }, - "time": "2021-03-07T09:25:29+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2022-08-28T14:55:35+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.8.2", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "dc960a912984efb74d0a90222870c72c87f10c91" + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", - "reference": "dc960a912984efb74d0a90222870c72c87f10c91", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "shasum": "" }, "require": { "php": ">=5.4.0", @@ -182,29 +237,50 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.9-dev" } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], @@ -221,9 +297,23 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.2" + "source": "https://github.com/guzzle/psr7/tree/1.9.0" }, - "time": "2021-04-26T09:17:50+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-06-20T21:43:03+00:00" }, { "name": "psr/http-message", @@ -237,13 +327,7 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.3.0" @@ -296,13 +380,7 @@ "type": "zip", "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.6" @@ -336,23 +414,17 @@ }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" + "reference": "639084e360537a19f9ee352433b84ce831f3d2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", + "reference": "639084e360537a19f9ee352433b84ce831f3d2da", + "shasum": "" }, "require": { "php": ">=7.1", @@ -365,7 +437,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -373,12 +445,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -409,7 +481,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0" }, "funding": [ { @@ -425,27 +497,21 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "shasum": "" }, "require": { "php": ">=7.1" @@ -456,7 +522,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -464,12 +530,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -499,7 +565,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -515,27 +581,21 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "shasum": "" }, "require": { "php": ">=7.1" @@ -543,7 +603,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -551,12 +611,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -581,7 +641,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" }, "funding": [ { @@ -597,35 +657,100 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:17:38+00:00" + "time": "2022-11-03T14:55:06+00:00" } ], "packages-dev": [ + { + "name": "composer/pcre", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/1.0.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-21T20:24:37+00:00" + }, { "name": "composer/semver", - "version": "3.2.5", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -670,7 +795,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.5" + "source": "https://github.com/composer/semver/tree/3.3.2" }, "funding": [ { @@ -686,35 +811,31 @@ "type": "tidelift" } ], - "time": "2021-05-24T12:41:47+00:00" + "time": "2022-04-01T19:23:25+00:00" }, { "name": "composer/xdebug-handler", - "version": "2.0.1", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496" + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/964adcdd3a28bf9ed5d9ac6450064e0d71ed7496", - "reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/9e36aeed4616366d2b690bdce11f71e9178c579a", + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a", + "shasum": "" }, "require": { + "composer/pcre": "^1", "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" }, "type": "library", "autoload": { @@ -740,7 +861,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.1" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.5" }, "funding": [ { @@ -756,40 +877,38 @@ "type": "tidelift" } ], - "time": "2021-05-05T19:37:51+00:00" + "time": "2022-02-24T20:20:32+00:00" }, { "name": "doctrine/annotations", - "version": "1.13.1", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f" + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f", - "reference": "e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "shasum": "" }, "require": { - "doctrine/lexer": "1.*", + "doctrine/lexer": "^1 || ^2", "ext-tokenizer": "*", "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" }, "type": "library", "autoload": { @@ -832,41 +951,79 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.1" + "source": "https://github.com/doctrine/annotations/tree/1.14.3" }, - "time": "2021-05-16T18:07:53+00:00" + "time": "2023-02-01T09:20:38+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -893,7 +1050,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -909,45 +1066,37 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.1", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "doctrine/deprecations": "^1.0", + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Doctrine\\Common\\Lexer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -979,7 +1128,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/2.1.0" }, "funding": [ { @@ -995,27 +1144,21 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-12-14T08:49:07+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.19.0", + "version": "v2.19.3", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "d5b8a9d852b292c2f8a035200fa6844b1f82300b" + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d5b8a9d852b292c2f8a035200fa6844b1f82300b", - "reference": "d5b8a9d852b292c2f8a035200fa6844b1f82300b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "shasum": "" }, "require": { "composer/semver": "^1.4 || ^2.0 || ^3.0", @@ -1102,7 +1245,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.19.0" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.19.3" }, "funding": [ { @@ -1110,47 +1253,42 @@ "type": "github" } ], - "time": "2021-05-03T21:43:24+00:00" + "time": "2021-11-15T17:17:55+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1166,7 +1304,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -1174,7 +1312,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "phar-io/manifest", @@ -1188,13 +1326,7 @@ "type": "zip", "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "ext-dom": "*", @@ -1253,13 +1385,7 @@ "type": "zip", "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": "^5.6 || ^7.0" @@ -1310,13 +1436,7 @@ "type": "zip", "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": "^5.6 || ^7.0 || ^8.0" @@ -1357,6 +1477,7 @@ "issues": "https://github.com/PHP-CS-Fixer/diff/issues", "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" }, + "abandoned": true, "time": "2020-10-14T08:39:05+00:00" }, { @@ -1371,13 +1492,7 @@ "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": "^7.2 || ^8.0" @@ -1420,23 +1535,17 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" }, "require": { "ext-filter": "*", @@ -1446,7 +1555,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1476,36 +1586,36 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -1531,45 +1641,40 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2022-10-14T12:47:21+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "doctrine/instantiator": "^1.2 || ^2.0", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1604,9 +1709,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2023-02-02T15:41:36+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1620,13 +1725,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "ext-dom": "*", @@ -1683,23 +1782,17 @@ }, { "name": "phpunit/php-file-iterator", - "version": "2.0.3", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357" + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4b49fb70f067272b659ef0174ff9ca40fdaa6357", - "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" }, "require": { "php": ">=7.1" @@ -1737,7 +1830,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" }, "funding": [ { @@ -1745,7 +1838,7 @@ "type": "github" } ], - "time": "2020-11-30T08:25:21+00:00" + "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", @@ -1759,13 +1852,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.3.3" @@ -1810,13 +1897,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.1" @@ -1865,23 +1946,17 @@ }, { "name": "phpunit/php-token-stream", - "version": "3.1.2", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "472b687829041c24b25f475e14c2f38a09edf1c2" + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/472b687829041c24b25f475e14c2f38a09edf1c2", - "reference": "472b687829041c24b25f475e14c2f38a09edf1c2", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "shasum": "" }, "require": { "ext-tokenizer": "*", @@ -1918,7 +1993,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.2" + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" }, "funding": [ { @@ -1927,7 +2002,7 @@ } ], "abandoned": true, - "time": "2020-11-30T08:38:46+00:00" + "time": "2021-07-26T12:15:06+00:00" }, { "name": "phpunit/phpunit", @@ -1941,13 +2016,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "doctrine/instantiator": "^1.1", @@ -2035,13 +2104,7 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.3.0" @@ -2080,26 +2143,20 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -2128,9 +2185,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -2144,13 +2201,7 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.2.0" @@ -2200,13 +2251,7 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.3.0" @@ -2256,13 +2301,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.6" @@ -2307,23 +2346,17 @@ }, { "name": "sebastian/comparator", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "shasum": "" }, "require": { "php": ">=7.1", @@ -2375,7 +2408,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5" }, "funding": [ { @@ -2383,7 +2416,7 @@ "type": "github" } ], - "time": "2020-11-30T08:04:30+00:00" + "time": "2022-09-14T12:31:48+00:00" }, { "name": "sebastian/diff", @@ -2397,13 +2430,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.1" @@ -2469,13 +2496,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.1" @@ -2528,23 +2549,17 @@ }, { "name": "sebastian/exporter", - "version": "3.1.3", + "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", + "shasum": "" }, "require": { "php": ">=7.0", @@ -2552,7 +2567,7 @@ }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2599,7 +2614,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.5" }, "funding": [ { @@ -2607,7 +2622,7 @@ "type": "github" } ], - "time": "2020-11-30T07:47:53+00:00" + "time": "2022-09-14T06:00:17+00:00" }, { "name": "sebastian/global-state", @@ -2621,13 +2636,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": "^7.0" @@ -2682,13 +2691,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.0", @@ -2745,13 +2748,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.0" @@ -2806,13 +2803,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.0" @@ -2875,13 +2866,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.1" @@ -2933,13 +2918,7 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.6" @@ -2976,70 +2955,37 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.2", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcs", + "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -3051,48 +2997,44 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2018-11-07T22:31:41+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "symfony/console", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "058553870f7809087fa80fa734704a21b9bcaeb2" + "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/058553870f7809087fa80fa734704a21b9bcaeb2", - "reference": "058553870f7809087fa80fa734704a21b9bcaeb2", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/console/zipball/c77433ddc6cdc689caf48065d9ea22ca0853fbd9", + "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9", + "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -3100,16 +3042,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3149,7 +3091,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.0" + "source": "https://github.com/symfony/console/tree/v5.4.21" }, "funding": [ { @@ -3165,27 +3107,21 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-25T16:59:41+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" }, "require": { "php": ">=7.1" @@ -3193,7 +3129,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3222,7 +3158,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -3238,33 +3174,27 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "67a5f354afa8e2f231081b3fa11a5912f933c3ce" + "reference": "f0ae1383a8285dfc6752b8d8602790953118ff5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/67a5f354afa8e2f231081b3fa11a5912f933c3ce", - "reference": "67a5f354afa8e2f231081b3fa11a5912f933c3ce", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f0ae1383a8285dfc6752b8d8602790953118ff5a", + "reference": "f0ae1383a8285dfc6752b8d8602790953118ff5a", + "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.15" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { "symfony/dependency-injection": "<4.4" @@ -3274,14 +3204,14 @@ "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -3313,7 +3243,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.21" }, "funding": [ { @@ -3329,27 +3259,21 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "shasum": "" }, "require": { "php": ">=7.2.5", @@ -3361,7 +3285,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3398,7 +3322,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.2" }, "funding": [ { @@ -3414,31 +3338,27 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/filesystem", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "348116319d7fb7d1faa781d26a48922428013eb2" + "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/348116319d7fb7d1faa781d26a48922428013eb2", - "reference": "348116319d7fb7d1faa781d26a48922428013eb2", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", + "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", + "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8" + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3466,7 +3386,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.0" + "source": "https://github.com/symfony/filesystem/tree/v5.4.21" }, "funding": [ { @@ -3482,30 +3402,26 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/finder", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0ae3f047bed4edff6fd35b26a9a6bfdc92c953c6" + "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0ae3f047bed4edff6fd35b26a9a6bfdc92c953c6", - "reference": "0ae3f047bed4edff6fd35b26a9a6bfdc92c953c6", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/finder/zipball/078e9a5e1871fcfe6a5ce421b539344c21afef19", + "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19", + "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3533,7 +3449,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.0" + "source": "https://github.com/symfony/finder/tree/v5.4.21" }, "funding": [ { @@ -3549,33 +3465,27 @@ "type": "tidelift" } ], - "time": "2021-05-26T12:52:38+00:00" + "time": "2023-02-16T09:33:00+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "162e886ca035869866d233a2bfef70cc28f9bbe5" + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/162e886ca035869866d233a2bfef70cc28f9bbe5", - "reference": "162e886ca035869866d233a2bfef70cc28f9bbe5", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3608,7 +3518,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.3.0" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" }, "funding": [ { @@ -3624,38 +3534,35 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3663,12 +3570,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3693,7 +3600,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -3709,27 +3616,21 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/24b72c6baa32c746a4d0840147c9715e42bb68ab", - "reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "shasum": "" }, "require": { "php": ">=7.1" @@ -3740,7 +3641,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3748,12 +3649,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3780,7 +3681,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -3796,38 +3697,35 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:17:38+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3835,12 +3733,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3866,7 +3764,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -3882,7 +3780,7 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php70", @@ -3896,13 +3794,7 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=7.1" @@ -3960,23 +3852,17 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "shasum": "" }, "require": { "php": ">=7.1" @@ -3984,7 +3870,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3992,12 +3878,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -4025,7 +3911,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -4041,27 +3927,21 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" }, "require": { "php": ">=7.1" @@ -4069,7 +3949,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4077,12 +3957,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -4114,7 +3994,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -4130,31 +4010,25 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "53e36cb1c160505cdaf1ef201501669c4c317191" + "reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/53e36cb1c160505cdaf1ef201501669c4c317191", - "reference": "53e36cb1c160505cdaf1ef201501669c4c317191", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/process/zipball/d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd", + "reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd", + "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -4182,7 +4056,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.0" + "source": "https://github.com/symfony/process/tree/v5.4.21" }, "funding": [ { @@ -4198,31 +4072,29 @@ "type": "tidelift" } ], - "time": "2021-05-26T12:52:38+00:00" + "time": "2023-02-21T19:46:44+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -4230,7 +4102,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4267,7 +4139,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -4283,31 +4155,25 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "313d02f59d6543311865007e5ff4ace05b35ee65" + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/313d02f59d6543311865007e5ff4ace05b35ee65", - "reference": "313d02f59d6543311865007e5ff4ace05b35ee65", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f83692cd869a6f2391691d40a01e8acb89e76fee", + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee", + "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/service-contracts": "^1.0|^2" + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", "autoload": { @@ -4335,7 +4201,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.3.0" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.21" }, "funding": [ { @@ -4351,27 +4217,21 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/string", - "version": "v5.3.0", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "a9a0f8b6aafc5d2d1c116dcccd1573a95153515b" + "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/a9a0f8b6aafc5d2d1c116dcccd1573a95153515b", - "reference": "a9a0f8b6aafc5d2d1c116dcccd1573a95153515b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/string/zipball/edac10d167b78b1d90f46a80320d632de0bd9f2f", + "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f", + "shasum": "" }, "require": { "php": ">=7.2.5", @@ -4381,20 +4241,23 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -4424,7 +4287,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.0" + "source": "https://github.com/symfony/string/tree/v5.4.21" }, "funding": [ { @@ -4440,27 +4303,21 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2023-02-22T08:00:55+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" }, "require": { "ext-dom": "*", @@ -4488,7 +4345,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -4496,31 +4353,25 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -4558,9 +4409,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], @@ -4575,5 +4426,5 @@ "ext-mbstring": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/docs/Api/DeliveryApi.md b/docs/Api/DeliveryApi.md index 737f57b..d54f991 100644 --- a/docs/Api/DeliveryApi.md +++ b/docs/Api/DeliveryApi.md @@ -30,8 +30,8 @@ Method | HTTP request | Description [**listPriceTriggeredDeliveryOrders**](DeliveryApi.md#listPriceTriggeredDeliveryOrders) | **GET** /delivery/{settle}/price_orders | List all auto orders [**createPriceTriggeredDeliveryOrder**](DeliveryApi.md#createPriceTriggeredDeliveryOrder) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order [**cancelPriceTriggeredDeliveryOrderList**](DeliveryApi.md#cancelPriceTriggeredDeliveryOrderList) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders -[**getPriceTriggeredDeliveryOrder**](DeliveryApi.md#getPriceTriggeredDeliveryOrder) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order -[**cancelPriceTriggeredDeliveryOrder**](DeliveryApi.md#cancelPriceTriggeredDeliveryOrder) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order +[**getPriceTriggeredDeliveryOrder**](DeliveryApi.md#getPriceTriggeredDeliveryOrder) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a price-triggered order +[**cancelPriceTriggeredDeliveryOrder**](DeliveryApi.md#cancelPriceTriggeredDeliveryOrder) | **DELETE** /delivery/{settle}/price_orders/{order_id} | cancel a price-triggered order ## listDeliveryContracts @@ -172,7 +172,7 @@ $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract $associate_array['interval'] = '0'; // string | Order depth. 0 means no aggregation is applied. default to 0 $associate_array['limit'] = 10; // int | Maximum number of order depth data in asks or bids -$associate_array['with_id'] = false; // bool | Whether order book update ID would be returned. This ID increments by 1 on every order book update +$associate_array['with_id'] = false; // bool | Whether the order book update ID will be returned. This ID increases by 1 on every order book update try { $result = $apiInstance->listDeliveryOrderBook($associate_array); @@ -196,7 +196,7 @@ Name | Type | Description | Notes **contract** | **string**| Futures contract | **interval** | **string**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] - **with_id** | **bool**| Whether order book update ID would be returned. This ID increments by 1 on every order book update | [optional] [default to false] + **with_id** | **bool**| Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [optional] [default to false] ### Return type @@ -236,8 +236,8 @@ $apiInstance = new GateApi\Api\DeliveryApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list -$associate_array['last_id'] = '12345'; // string | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['last_id'] = '12345'; // string | Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range $associate_array['from'] = 1546905600; // int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. $associate_array['to'] = 1546935600; // int | Specify end time in Unix seconds, default to current time @@ -261,8 +261,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **last_id** | **string**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **last_id** | **string**| Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] **from** | **int**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] **to** | **int**| Specify end time in Unix seconds, default to current time | [optional] @@ -308,8 +308,8 @@ $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract $associate_array['from'] = 1546905600; // int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified $associate_array['to'] = 1546935600; // int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time -$associate_array['limit'] = 100; // int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. -$associate_array['interval'] = '5m'; // string | Interval time between data points +$associate_array['limit'] = 100; // int | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. +$associate_array['interval'] = '5m'; // string | Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 try { $result = $apiInstance->listDeliveryCandlesticks($associate_array); @@ -333,8 +333,8 @@ Name | Type | Description | Notes **contract** | **string**| Futures contract | **from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] - **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] - **interval** | **string**| Interval time between data points | [optional] [default to '5m'] + **limit** | **int**| Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **interval** | **string**| Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 | [optional] [default to '5m'] ### Return type @@ -433,7 +433,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( new GuzzleHttp\Client() ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listDeliveryInsuranceLedger($associate_array); @@ -454,7 +454,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -557,7 +557,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['from'] = 1547706332; // int | Start timestamp $associate_array['to'] = 1547706332; // int | End timestamp $associate_array['type'] = 'dnw'; // string | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate @@ -581,7 +581,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **from** | **int**| Start timestamp | [optional] **to** | **int**| End timestamp | [optional] **type** | **string**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] @@ -924,7 +924,7 @@ Name | Type | Description | Notes List futures orders -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -943,9 +943,9 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['status'] = 'open'; // string | List orders based on status +$associate_array['status'] = 'open'; // string | Only list the orders with this status $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 $associate_array['last_id'] = '12345'; // string | Specify list staring point using the `id` of last record in previous list-query results $associate_array['count_total'] = 0; // int | Whether to return total number matched. Default to 0(no return) @@ -969,9 +969,9 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **status** | **string**| List orders based on status | + **status** | **string**| Only list the orders with this status | **contract** | **string**| Futures contract | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **last_id** | **string**| Specify list staring point using the `id` of last record in previous list-query results | [optional] **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] @@ -1000,7 +1000,7 @@ Name | Type | Description | Notes Create a futures order -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -1064,7 +1064,7 @@ Name | Type | Description | Notes Cancel all `open` orders matched -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -1084,7 +1084,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( ); $settle = 'usdt'; // string | Settle currency $contract = 'BTC_USDT_20200814'; // string | Futures contract -$side = 'ask'; // string | All bids or asks. Both included in not specified +$side = 'ask'; // string | All bids or asks. Both included if not specified try { $result = $apiInstance->cancelDeliveryOrders($settle, $contract, $side); @@ -1104,7 +1104,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | - **side** | **string**| All bids or asks. Both included in not specified | [optional] + **side** | **string**| All bids or asks. Both included if not specified | [optional] ### Return type @@ -1130,7 +1130,7 @@ Name | Type | Description | Notes Get a single order -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -1149,7 +1149,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = '12345'; // string | ID returned on order successfully being created +$order_id = '12345'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->getDeliveryOrder($settle, $order_id); @@ -1168,7 +1168,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type @@ -1211,7 +1211,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = '12345'; // string | ID returned on order successfully being created +$order_id = '12345'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->cancelDeliveryOrder($settle, $order_id); @@ -1230,7 +1230,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type @@ -1275,7 +1275,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract $associate_array['order'] = 12345; // int | Futures order ID, return related data only if specified -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 $associate_array['last_id'] = '12345'; // string | Specify list staring point using the `id` of last record in previous list-query results $associate_array['count_total'] = 0; // int | Whether to return total number matched. Default to 0(no return) @@ -1301,7 +1301,7 @@ Name | Type | Description | Notes **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | [optional] **order** | **int**| Futures order ID, return related data only if specified | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **last_id** | **string**| Specify list staring point using the `id` of last record in previous list-query results | [optional] **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] @@ -1348,7 +1348,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listDeliveryPositionClose($associate_array); @@ -1370,7 +1370,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -1414,7 +1414,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['at'] = 0; // int | Specify a liquidation timestamp try { @@ -1437,7 +1437,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] ### Return type @@ -1482,7 +1482,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT_20200814'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['at'] = 0; // int | Specify a settlement timestamp try { @@ -1505,7 +1505,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **at** | **int**| Specify a settlement timestamp | [optional] [default to 0] ### Return type @@ -1549,9 +1549,9 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['status'] = 'status_example'; // string | List orders based on status +$associate_array['status'] = 'status_example'; // string | Only list the orders with this status $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 try { @@ -1573,9 +1573,9 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **status** | **string**| List orders based on status | + **status** | **string**| Only list the orders with this status | **contract** | **string**| Futures contract, return related data only if specified | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -1724,7 +1724,7 @@ Name | Type | Description | Notes > \GateApi\Model\FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder($settle, $order_id) -Get a single order +Get a price-triggered order ### Example @@ -1743,7 +1743,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = 'order_id_example'; // string | ID returned on order successfully being created +$order_id = 'order_id_example'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->getPriceTriggeredDeliveryOrder($settle, $order_id); @@ -1762,7 +1762,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type @@ -1786,7 +1786,7 @@ Name | Type | Description | Notes > \GateApi\Model\FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder($settle, $order_id) -Cancel a single order +cancel a price-triggered order ### Example @@ -1805,7 +1805,7 @@ $apiInstance = new GateApi\Api\DeliveryApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = 'order_id_example'; // string | ID returned on order successfully being created +$order_id = 'order_id_example'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->cancelPriceTriggeredDeliveryOrder($settle, $order_id); @@ -1824,7 +1824,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type diff --git a/docs/Api/FlashSwapApi.md b/docs/Api/FlashSwapApi.md new file mode 100644 index 0000000..72598c6 --- /dev/null +++ b/docs/Api/FlashSwapApi.md @@ -0,0 +1,318 @@ +# GateApi\FlashSwapApi + +All URIs are relative to *https://api.gateio.ws/api/v4* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**listFlashSwapCurrencies**](FlashSwapApi.md#listFlashSwapCurrencies) | **GET** /flash_swap/currencies | List all supported currencies in flash swap +[**listFlashSwapOrders**](FlashSwapApi.md#listFlashSwapOrders) | **GET** /flash_swap/orders | List all flash swap orders +[**createFlashSwapOrder**](FlashSwapApi.md#createFlashSwapOrder) | **POST** /flash_swap/orders | Create a flash swap order +[**getFlashSwapOrder**](FlashSwapApi.md#getFlashSwapOrder) | **GET** /flash_swap/orders/{order_id} | Get a single flash swap order's detail +[**previewFlashSwapOrder**](FlashSwapApi.md#previewFlashSwapOrder) | **POST** /flash_swap/orders/preview | Initiate a flash swap order preview + + +## listFlashSwapCurrencies + +> \GateApi\Model\FlashSwapCurrency[] listFlashSwapCurrencies() + +List all supported currencies in flash swap + +### Example + +```php +listFlashSwapCurrencies(); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FlashSwapApi->listFlashSwapCurrencies: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\GateApi\Model\FlashSwapCurrency[]**](../Model/FlashSwapCurrency.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listFlashSwapOrders + +> \GateApi\Model\FlashSwapOrder[] listFlashSwapOrders($status, $sell_currency, $buy_currency, $reverse, $limit, $page) + +List all flash swap orders + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FlashSwapApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['status'] = 1; // int | Flash swap order status `1` - success `2` - failure +$associate_array['sell_currency'] = 'BTC'; // string | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` +$associate_array['buy_currency'] = 'BTC'; // string | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` +$associate_array['reverse'] = true; // bool | If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['page'] = 1; // int | Page number + +try { + $result = $apiInstance->listFlashSwapOrders($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FlashSwapApi->listFlashSwapOrders: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **int**| Flash swap order status `1` - success `2` - failure | [optional] + **sell_currency** | **string**| Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | [optional] + **buy_currency** | **string**| Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | [optional] + **reverse** | **bool**| If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **page** | **int**| Page number | [optional] [default to 1] + +### Return type + +[**\GateApi\Model\FlashSwapOrder[]**](../Model/FlashSwapOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## createFlashSwapOrder + +> \GateApi\Model\FlashSwapOrder createFlashSwapOrder($flash_swap_order_request) + +Create a flash swap order + +Initiate a flash swap preview in advance because order creation requires a preview result + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FlashSwapApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$flash_swap_order_request = new \GateApi\Model\FlashSwapOrderRequest(); // \GateApi\Model\FlashSwapOrderRequest | + +try { + $result = $apiInstance->createFlashSwapOrder($flash_swap_order_request); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FlashSwapApi->createFlashSwapOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **flash_swap_order_request** | [**\GateApi\Model\FlashSwapOrderRequest**](../Model/FlashSwapOrderRequest.md)| | + +### Return type + +[**\GateApi\Model\FlashSwapOrder**](../Model/FlashSwapOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getFlashSwapOrder + +> \GateApi\Model\FlashSwapOrder getFlashSwapOrder($order_id) + +Get a single flash swap order's detail + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FlashSwapApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$order_id = 1; // int | Flash swap order ID + +try { + $result = $apiInstance->getFlashSwapOrder($order_id); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FlashSwapApi->getFlashSwapOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| Flash swap order ID | + +### Return type + +[**\GateApi\Model\FlashSwapOrder**](../Model/FlashSwapOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## previewFlashSwapOrder + +> \GateApi\Model\FlashSwapOrderPreview previewFlashSwapOrder($flash_swap_order_request) + +Initiate a flash swap order preview + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FlashSwapApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$flash_swap_order_request = new \GateApi\Model\FlashSwapOrderRequest(); // \GateApi\Model\FlashSwapOrderRequest | + +try { + $result = $apiInstance->previewFlashSwapOrder($flash_swap_order_request); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FlashSwapApi->previewFlashSwapOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **flash_swap_order_request** | [**\GateApi\Model\FlashSwapOrderRequest**](../Model/FlashSwapOrderRequest.md)| | + +### Return type + +[**\GateApi\Model\FlashSwapOrderPreview**](../Model/FlashSwapOrderPreview.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Api/FuturesApi.md b/docs/Api/FuturesApi.md index 12d35e3..0299125 100644 --- a/docs/Api/FuturesApi.md +++ b/docs/Api/FuturesApi.md @@ -9,10 +9,12 @@ Method | HTTP request | Description [**listFuturesOrderBook**](FuturesApi.md#listFuturesOrderBook) | **GET** /futures/{settle}/order_book | Futures order book [**listFuturesTrades**](FuturesApi.md#listFuturesTrades) | **GET** /futures/{settle}/trades | Futures trading history [**listFuturesCandlesticks**](FuturesApi.md#listFuturesCandlesticks) | **GET** /futures/{settle}/candlesticks | Get futures candlesticks +[**listFuturesPremiumIndex**](FuturesApi.md#listFuturesPremiumIndex) | **GET** /futures/{settle}/premium_index | Premium Index K-Line [**listFuturesTickers**](FuturesApi.md#listFuturesTickers) | **GET** /futures/{settle}/tickers | List futures tickers [**listFuturesFundingRateHistory**](FuturesApi.md#listFuturesFundingRateHistory) | **GET** /futures/{settle}/funding_rate | Funding rate history [**listFuturesInsuranceLedger**](FuturesApi.md#listFuturesInsuranceLedger) | **GET** /futures/{settle}/insurance | Futures insurance balance history [**listContractStats**](FuturesApi.md#listContractStats) | **GET** /futures/{settle}/contract_stats | Futures stats +[**getIndexConstituents**](FuturesApi.md#getIndexConstituents) | **GET** /futures/{settle}/index_constituents/{index} | Get index constituents [**listLiquidatedOrders**](FuturesApi.md#listLiquidatedOrders) | **GET** /futures/{settle}/liq_orders | Retrieve liquidation history [**listFuturesAccounts**](FuturesApi.md#listFuturesAccounts) | **GET** /futures/{settle}/accounts | Query futures account [**listFuturesAccountBook**](FuturesApi.md#listFuturesAccountBook) | **GET** /futures/{settle}/account_book | Query account book @@ -29,16 +31,21 @@ Method | HTTP request | Description [**listFuturesOrders**](FuturesApi.md#listFuturesOrders) | **GET** /futures/{settle}/orders | List futures orders [**createFuturesOrder**](FuturesApi.md#createFuturesOrder) | **POST** /futures/{settle}/orders | Create a futures order [**cancelFuturesOrders**](FuturesApi.md#cancelFuturesOrders) | **DELETE** /futures/{settle}/orders | Cancel all `open` orders matched +[**createBatchFuturesOrder**](FuturesApi.md#createBatchFuturesOrder) | **POST** /futures/{settle}/batch_orders | Create a batch of futures orders [**getFuturesOrder**](FuturesApi.md#getFuturesOrder) | **GET** /futures/{settle}/orders/{order_id} | Get a single order +[**amendFuturesOrder**](FuturesApi.md#amendFuturesOrder) | **PUT** /futures/{settle}/orders/{order_id} | Amend an order [**cancelFuturesOrder**](FuturesApi.md#cancelFuturesOrder) | **DELETE** /futures/{settle}/orders/{order_id} | Cancel a single order [**getMyTrades**](FuturesApi.md#getMyTrades) | **GET** /futures/{settle}/my_trades | List personal trading history +[**getMyTradesWithTimeRange**](FuturesApi.md#getMyTradesWithTimeRange) | **GET** /futures/{settle}/my_trades_timerange | List personal trading history by time range [**listPositionClose**](FuturesApi.md#listPositionClose) | **GET** /futures/{settle}/position_close | List position close history [**listLiquidates**](FuturesApi.md#listLiquidates) | **GET** /futures/{settle}/liquidates | List liquidation history +[**listAutoDeleverages**](FuturesApi.md#listAutoDeleverages) | **GET** /futures/{settle}/auto_deleverages | List Auto-Deleveraging History +[**countdownCancelAllFutures**](FuturesApi.md#countdownCancelAllFutures) | **POST** /futures/{settle}/countdown_cancel_all | Countdown cancel orders [**listPriceTriggeredOrders**](FuturesApi.md#listPriceTriggeredOrders) | **GET** /futures/{settle}/price_orders | List all auto orders [**createPriceTriggeredOrder**](FuturesApi.md#createPriceTriggeredOrder) | **POST** /futures/{settle}/price_orders | Create a price-triggered order [**cancelPriceTriggeredOrderList**](FuturesApi.md#cancelPriceTriggeredOrderList) | **DELETE** /futures/{settle}/price_orders | Cancel all open orders -[**getPriceTriggeredOrder**](FuturesApi.md#getPriceTriggeredOrder) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order -[**cancelPriceTriggeredOrder**](FuturesApi.md#cancelPriceTriggeredOrder) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order +[**getPriceTriggeredOrder**](FuturesApi.md#getPriceTriggeredOrder) | **GET** /futures/{settle}/price_orders/{order_id} | Get a price-triggered order +[**cancelPriceTriggeredOrder**](FuturesApi.md#cancelPriceTriggeredOrder) | **DELETE** /futures/{settle}/price_orders/{order_id} | cancel a price-triggered order ## listFuturesContracts @@ -179,7 +186,7 @@ $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract $associate_array['interval'] = '0'; // string | Order depth. 0 means no aggregation is applied. default to 0 $associate_array['limit'] = 10; // int | Maximum number of order depth data in asks or bids -$associate_array['with_id'] = false; // bool | Whether order book update ID would be returned. This ID increments by 1 on every order book update +$associate_array['with_id'] = false; // bool | Whether the order book update ID will be returned. This ID increases by 1 on every order book update try { $result = $apiInstance->listFuturesOrderBook($associate_array); @@ -203,7 +210,7 @@ Name | Type | Description | Notes **contract** | **string**| Futures contract | **interval** | **string**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] - **with_id** | **bool**| Whether order book update ID would be returned. This ID increments by 1 on every order book update | [optional] [default to false] + **with_id** | **bool**| Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [optional] [default to false] ### Return type @@ -225,7 +232,7 @@ No authorization required ## listFuturesTrades -> \GateApi\Model\FuturesTrade[] listFuturesTrades($settle, $contract, $limit, $last_id, $from, $to) +> \GateApi\Model\FuturesTrade[] listFuturesTrades($settle, $contract, $limit, $offset, $last_id, $from, $to) Futures trading history @@ -243,8 +250,9 @@ $apiInstance = new GateApi\Api\FuturesApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list -$associate_array['last_id'] = '12345'; // string | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 +$associate_array['last_id'] = '12345'; // string | Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range $associate_array['from'] = 1546905600; // int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. $associate_array['to'] = 1546935600; // int | Specify end time in Unix seconds, default to current time @@ -268,8 +276,9 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **last_id** | **string**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **last_id** | **string**| Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] **from** | **int**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] **to** | **int**| Specify end time in Unix seconds, default to current time | [optional] @@ -315,8 +324,8 @@ $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract $associate_array['from'] = 1546905600; // int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified $associate_array['to'] = 1546935600; // int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time -$associate_array['limit'] = 100; // int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. -$associate_array['interval'] = '5m'; // string | Interval time between data points +$associate_array['limit'] = 100; // int | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. +$associate_array['interval'] = '5m'; // string | Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 try { $result = $apiInstance->listFuturesCandlesticks($associate_array); @@ -340,8 +349,8 @@ Name | Type | Description | Notes **contract** | **string**| Futures contract | **from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] - **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] - **interval** | **string**| Interval time between data points | [optional] [default to '5m'] + **limit** | **int**| Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **interval** | **string**| Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 | [optional] [default to '5m'] ### Return type @@ -361,6 +370,76 @@ No authorization required [[Back to README]](../../README.md) +## listFuturesPremiumIndex + +> \GateApi\Model\FuturesPremiumIndex[] listFuturesPremiumIndex($settle, $contract, $from, $to, $limit, $interval) + +Premium Index K-Line + +Maximum of 1000 points can be returned in a query. Be sure not to exceed the limit when specifying from, to and interval + +### Example + +```php +listFuturesPremiumIndex($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->listFuturesPremiumIndex: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **contract** | **string**| Futures contract | + **from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] + **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] + **limit** | **int**| Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **interval** | **string**| Interval time between data points | [optional] [default to '5m'] + +### Return type + +[**\GateApi\Model\FuturesPremiumIndex[]**](../Model/FuturesPremiumIndex.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listFuturesTickers > \GateApi\Model\FuturesTicker[] listFuturesTickers($settle, $contract) @@ -441,7 +520,7 @@ $apiInstance = new GateApi\Api\FuturesApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listFuturesFundingRateHistory($associate_array); @@ -463,7 +542,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -502,7 +581,7 @@ $apiInstance = new GateApi\Api\FuturesApi( new GuzzleHttp\Client() ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listFuturesInsuranceLedger($associate_array); @@ -523,7 +602,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -609,6 +688,64 @@ No authorization required [[Back to README]](../../README.md) +## getIndexConstituents + +> \GateApi\Model\FuturesIndexConstituents getIndexConstituents($settle, $index) + +Get index constituents + +### Example + +```php +getIndexConstituents($settle, $index); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->getIndexConstituents: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **index** | **string**| Index name | + +### Return type + +[**\GateApi\Model\FuturesIndexConstituents**](../Model/FuturesIndexConstituents.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listLiquidatedOrders > \GateApi\Model\FuturesLiquidate[] listLiquidatedOrders($settle, $contract, $from, $to, $limit) @@ -633,7 +770,7 @@ $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified $associate_array['from'] = 1547706332; // int | Start timestamp $associate_array['to'] = 1547706332; // int | End timestamp -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listLiquidatedOrders($associate_array); @@ -657,7 +794,7 @@ Name | Type | Description | Notes **contract** | **string**| Futures contract, return related data only if specified | [optional] **from** | **int**| Start timestamp | [optional] **to** | **int**| End timestamp | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -760,7 +897,7 @@ $apiInstance = new GateApi\Api\FuturesApi( $config ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['from'] = 1547706332; // int | Start timestamp $associate_array['to'] = 1547706332; // int | End timestamp $associate_array['type'] = 'dnw'; // string | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate @@ -784,7 +921,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **from** | **int**| Start timestamp | [optional] **to** | **int**| End timestamp | [optional] **type** | **string**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] @@ -1317,7 +1454,7 @@ Name | Type | Description | Notes ## updateDualModePositionLeverage -> \GateApi\Model\Position[] updateDualModePositionLeverage($settle, $contract, $leverage) +> \GateApi\Model\Position[] updateDualModePositionLeverage($settle, $contract, $leverage, $cross_leverage_limit) Update position leverage in dual mode @@ -1340,9 +1477,10 @@ $apiInstance = new GateApi\Api\FuturesApi( $settle = 'usdt'; // string | Settle currency $contract = 'BTC_USDT'; // string | Futures contract $leverage = '10'; // string | New position leverage +$cross_leverage_limit = '10'; // string | Cross margin leverage(valid only when `leverage` is 0) try { - $result = $apiInstance->updateDualModePositionLeverage($settle, $contract, $leverage); + $result = $apiInstance->updateDualModePositionLeverage($settle, $contract, $leverage, $cross_leverage_limit); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; @@ -1360,6 +1498,7 @@ Name | Type | Description | Notes **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | **leverage** | **string**| New position leverage | + **cross_leverage_limit** | **string**| Cross margin leverage(valid only when `leverage` is 0) | [optional] ### Return type @@ -1445,11 +1584,11 @@ Name | Type | Description | Notes ## listFuturesOrders -> \GateApi\Model\FuturesOrder[] listFuturesOrders($settle, $contract, $status, $limit, $offset, $last_id, $count_total) +> \GateApi\Model\FuturesOrder[] listFuturesOrders($settle, $contract, $status, $limit, $offset, $last_id) List futures orders -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -1469,11 +1608,10 @@ $apiInstance = new GateApi\Api\FuturesApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract -$associate_array['status'] = 'open'; // string | List orders based on status -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['status'] = 'open'; // string | Only list the orders with this status +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 $associate_array['last_id'] = '12345'; // string | Specify list staring point using the `id` of last record in previous list-query results -$associate_array['count_total'] = 0; // int | Whether to return total number matched. Default to 0(no return) try { $result = $apiInstance->listFuturesOrders($associate_array); @@ -1495,11 +1633,10 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | - **status** | **string**| List orders based on status | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **status** | **string**| Only list the orders with this status | + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **last_id** | **string**| Specify list staring point using the `id` of last record in previous list-query results | [optional] - **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type @@ -1525,7 +1662,7 @@ Name | Type | Description | Notes Create a futures order -Zero-fill order cannot be retrieved 60 seconds after cancellation +- Creating futures orders requires `size`, which is number of contracts instead of currency amount. You can use `quanto_multiplier` in contract detail response to know how much currency 1 size contract represents - Zero-filled order cannot be retrieved 10 minutes after order cancellation. You will get a 404 not found for such orders - Set `reduce_only` to `true` can keep the position from changing side when reducing position size - In single position mode, to close a position, you need to set `size` to 0 and `close` to `true` - In dual position mode, to close one side position, you need to set `auto_size` side, `reduce_only` to true and `size` to 0 ### Example @@ -1589,7 +1726,7 @@ Name | Type | Description | Notes Cancel all `open` orders matched -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -1609,7 +1746,7 @@ $apiInstance = new GateApi\Api\FuturesApi( ); $settle = 'usdt'; // string | Settle currency $contract = 'BTC_USDT'; // string | Futures contract -$side = 'ask'; // string | All bids or asks. Both included in not specified +$side = 'ask'; // string | All bids or asks. Both included if not specified try { $result = $apiInstance->cancelFuturesOrders($settle, $contract, $side); @@ -1629,7 +1766,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract | - **side** | **string**| All bids or asks. Both included in not specified | [optional] + **side** | **string**| All bids or asks. Both included if not specified | [optional] ### Return type @@ -1649,13 +1786,77 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## createBatchFuturesOrder + +> \GateApi\Model\BatchFuturesOrder[] createBatchFuturesOrder($settle, $futures_order) + +Create a batch of futures orders + +- Up to 10 orders per request - If any of the order's parameters are missing or in the wrong format, all of them will not be executed, and a http status 400 error will be returned directly - If the parameters are checked and passed, all are executed. Even if there is a business logic error in the middle (such as insufficient funds), it will not affect other execution orders - The returned result is in array format, and the order corresponds to the orders in the request body - In the returned result, the `succeeded` field of type bool indicates whether the execution was successful or not - If the execution is successful, the normal order content is included; if the execution fails, the `label` field is included to indicate the cause of the error - In the rate limiting, each order is counted individually + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FuturesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$settle = 'usdt'; // string | Settle currency +$futures_order = array(new \GateApi\Model\FuturesOrder()); // \GateApi\Model\FuturesOrder[] | + +try { + $result = $apiInstance->createBatchFuturesOrder($settle, $futures_order); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->createBatchFuturesOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **futures_order** | [**\GateApi\Model\FuturesOrder[]**](../Model/FuturesOrder.md)| | + +### Return type + +[**\GateApi\Model\BatchFuturesOrder[]**](../Model/BatchFuturesOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## getFuturesOrder > \GateApi\Model\FuturesOrder getFuturesOrder($settle, $order_id) Get a single order -Zero-fill order cannot be retrieved 60 seconds after cancellation +Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example @@ -1674,7 +1875,7 @@ $apiInstance = new GateApi\Api\FuturesApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. +$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. try { $result = $apiInstance->getFuturesOrder($settle, $order_id); @@ -1693,7 +1894,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. | + **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. | ### Return type @@ -1713,6 +1914,70 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## amendFuturesOrder + +> \GateApi\Model\FuturesOrder amendFuturesOrder($settle, $order_id, $futures_order_amendment) + +Amend an order + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FuturesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$settle = 'usdt'; // string | Settle currency +$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. +$futures_order_amendment = new \GateApi\Model\FuturesOrderAmendment(); // \GateApi\Model\FuturesOrderAmendment | + +try { + $result = $apiInstance->amendFuturesOrder($settle, $order_id, $futures_order_amendment); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->amendFuturesOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. | + **futures_order_amendment** | [**\GateApi\Model\FuturesOrderAmendment**](../Model/FuturesOrderAmendment.md)| | + +### Return type + +[**\GateApi\Model\FuturesOrder**](../Model/FuturesOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## cancelFuturesOrder > \GateApi\Model\FuturesOrder cancelFuturesOrder($settle, $order_id) @@ -1736,7 +2001,7 @@ $apiInstance = new GateApi\Api\FuturesApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. +$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. try { $result = $apiInstance->cancelFuturesOrder($settle, $order_id); @@ -1755,7 +2020,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. | + **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. | ### Return type @@ -1777,7 +2042,7 @@ Name | Type | Description | Notes ## getMyTrades -> \GateApi\Model\MyFuturesTrade[] getMyTrades($settle, $contract, $order, $limit, $offset, $last_id, $count_total) +> \GateApi\Model\MyFuturesTrade[] getMyTrades($settle, $contract, $order, $limit, $offset, $last_id) List personal trading history @@ -1800,10 +2065,9 @@ $apiInstance = new GateApi\Api\FuturesApi( $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified $associate_array['order'] = 12345; // int | Futures order ID, return related data only if specified -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 $associate_array['last_id'] = '12345'; // string | Specify list staring point using the `id` of last record in previous list-query results -$associate_array['count_total'] = 0; // int | Whether to return total number matched. Default to 0(no return) try { $result = $apiInstance->getMyTrades($associate_array); @@ -1826,10 +2090,81 @@ Name | Type | Description | Notes **settle** | **string**| Settle currency | **contract** | **string**| Futures contract, return related data only if specified | [optional] **order** | **int**| Futures order ID, return related data only if specified | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **last_id** | **string**| Specify list staring point using the `id` of last record in previous list-query results | [optional] - **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] + +### Return type + +[**\GateApi\Model\MyFuturesTrade[]**](../Model/MyFuturesTrade.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getMyTradesWithTimeRange + +> \GateApi\Model\MyFuturesTrade[] getMyTradesWithTimeRange($settle, $contract, $from, $to, $limit, $offset) + +List personal trading history by time range + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FuturesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['settle'] = 'usdt'; // string | Settle currency +$associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified +$associate_array['from'] = 1547706332; // int | Start timestamp +$associate_array['to'] = 1547706332; // int | End timestamp +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 + +try { + $result = $apiInstance->getMyTradesWithTimeRange($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->getMyTradesWithTimeRange: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **contract** | **string**| Futures contract, return related data only if specified | [optional] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -1851,7 +2186,7 @@ Name | Type | Description | Notes ## listPositionClose -> \GateApi\Model\PositionClose[] listPositionClose($settle, $contract, $limit, $offset) +> \GateApi\Model\PositionClose[] listPositionClose($settle, $contract, $limit, $offset, $from, $to) List position close history @@ -1873,8 +2208,10 @@ $apiInstance = new GateApi\Api\FuturesApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 +$associate_array['from'] = 1547706332; // int | Start timestamp +$associate_array['to'] = 1547706332; // int | End timestamp try { $result = $apiInstance->listPositionClose($associate_array); @@ -1896,8 +2233,10 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract, return related data only if specified | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] ### Return type @@ -1941,7 +2280,7 @@ $apiInstance = new GateApi\Api\FuturesApi( ); $associate_array['settle'] = 'usdt'; // string | Settle currency $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['at'] = 0; // int | Specify a liquidation timestamp try { @@ -1964,7 +2303,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | **contract** | **string**| Futures contract, return related data only if specified | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] ### Return type @@ -1985,6 +2324,138 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## listAutoDeleverages + +> \GateApi\Model\FuturesAutoDeleverage[] listAutoDeleverages($settle, $contract, $limit, $at) + +List Auto-Deleveraging History + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FuturesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['settle'] = 'usdt'; // string | Settle currency +$associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['at'] = 0; // int | Specify an auto-deleveraging timestamp + +try { + $result = $apiInstance->listAutoDeleverages($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->listAutoDeleverages: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **contract** | **string**| Futures contract, return related data only if specified | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **at** | **int**| Specify an auto-deleveraging timestamp | [optional] [default to 0] + +### Return type + +[**\GateApi\Model\FuturesAutoDeleverage[]**](../Model/FuturesAutoDeleverage.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## countdownCancelAllFutures + +> \GateApi\Model\TriggerTime countdownCancelAllFutures($settle, $countdown_cancel_all_futures_task) + +Countdown cancel orders + +When the timeout set by the user is reached, if there is no cancel or set a new countdown, the related pending orders will be automatically cancelled. This endpoint can be called repeatedly to set a new countdown or cancel the countdown. For example, call this endpoint at 30s intervals, each countdown`timeout` is set to 30s. If this endpoint is not called again within 30 seconds, all pending orders on the specified `market` will be automatically cancelled, if no `market` is specified, all market pending orders will be cancelled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will expire and the cacnel function will be cancelled. + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\FuturesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$settle = 'usdt'; // string | Settle currency +$countdown_cancel_all_futures_task = new \GateApi\Model\CountdownCancelAllFuturesTask(); // \GateApi\Model\CountdownCancelAllFuturesTask | + +try { + $result = $apiInstance->countdownCancelAllFutures($settle, $countdown_cancel_all_futures_task); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling FuturesApi->countdownCancelAllFutures: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **string**| Settle currency | + **countdown_cancel_all_futures_task** | [**\GateApi\Model\CountdownCancelAllFuturesTask**](../Model/CountdownCancelAllFuturesTask.md)| | + +### Return type + +[**\GateApi\Model\TriggerTime**](../Model/TriggerTime.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listPriceTriggeredOrders > \GateApi\Model\FuturesPriceTriggeredOrder[] listPriceTriggeredOrders($settle, $status, $contract, $limit, $offset) @@ -2008,9 +2479,9 @@ $apiInstance = new GateApi\Api\FuturesApi( $config ); $associate_array['settle'] = 'usdt'; // string | Settle currency -$associate_array['status'] = 'status_example'; // string | List orders based on status +$associate_array['status'] = 'status_example'; // string | Only list the orders with this status $associate_array['contract'] = 'BTC_USDT'; // string | Futures contract, return related data only if specified -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 try { @@ -2032,9 +2503,9 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **status** | **string**| List orders based on status | + **status** | **string**| Only list the orders with this status | **contract** | **string**| Futures contract, return related data only if specified | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -2183,7 +2654,7 @@ Name | Type | Description | Notes > \GateApi\Model\FuturesPriceTriggeredOrder getPriceTriggeredOrder($settle, $order_id) -Get a single order +Get a price-triggered order ### Example @@ -2202,7 +2673,7 @@ $apiInstance = new GateApi\Api\FuturesApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = 'order_id_example'; // string | ID returned on order successfully being created +$order_id = 'order_id_example'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->getPriceTriggeredOrder($settle, $order_id); @@ -2221,7 +2692,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type @@ -2245,7 +2716,7 @@ Name | Type | Description | Notes > \GateApi\Model\FuturesPriceTriggeredOrder cancelPriceTriggeredOrder($settle, $order_id) -Cancel a single order +cancel a price-triggered order ### Example @@ -2264,7 +2735,7 @@ $apiInstance = new GateApi\Api\FuturesApi( $config ); $settle = 'usdt'; // string | Settle currency -$order_id = 'order_id_example'; // string | ID returned on order successfully being created +$order_id = 'order_id_example'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->cancelPriceTriggeredOrder($settle, $order_id); @@ -2283,7 +2754,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **string**| Settle currency | - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type diff --git a/docs/Api/MarginApi.md b/docs/Api/MarginApi.md index 0f692ab..9f24104 100644 --- a/docs/Api/MarginApi.md +++ b/docs/Api/MarginApi.md @@ -18,19 +18,24 @@ Method | HTTP request | Description [**updateLoan**](MarginApi.md#updateLoan) | **PATCH** /margin/loans/{loan_id} | Modify a loan [**listLoanRepayments**](MarginApi.md#listLoanRepayments) | **GET** /margin/loans/{loan_id}/repayment | List loan repayment records [**repayLoan**](MarginApi.md#repayLoan) | **POST** /margin/loans/{loan_id}/repayment | Repay a loan -[**listLoanRecords**](MarginApi.md#listLoanRecords) | **GET** /margin/loan_records | List repayment records of specified loan +[**listLoanRecords**](MarginApi.md#listLoanRecords) | **GET** /margin/loan_records | List repayment records of a specific loan [**getLoanRecord**](MarginApi.md#getLoanRecord) | **GET** /margin/loan_records/{loan_record_id} | Get one single loan record [**updateLoanRecord**](MarginApi.md#updateLoanRecord) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record [**getAutoRepayStatus**](MarginApi.md#getAutoRepayStatus) | **GET** /margin/auto_repay | Retrieve user auto repayment setting [**setAutoRepay**](MarginApi.md#setAutoRepay) | **POST** /margin/auto_repay | Update user's auto repayment setting +[**getMarginTransferable**](MarginApi.md#getMarginTransferable) | **GET** /margin/transferable | Get the max transferable amount for a specific margin currency +[**getMarginBorrowable**](MarginApi.md#getMarginBorrowable) | **GET** /margin/borrowable | Get the max borrowable amount for a specific margin currency [**listCrossMarginCurrencies**](MarginApi.md#listCrossMarginCurrencies) | **GET** /margin/cross/currencies | Currencies supported by cross margin. [**getCrossMarginCurrency**](MarginApi.md#getCrossMarginCurrency) | **GET** /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin [**getCrossMarginAccount**](MarginApi.md#getCrossMarginAccount) | **GET** /margin/cross/accounts | Retrieve cross margin account +[**listCrossMarginAccountBook**](MarginApi.md#listCrossMarginAccountBook) | **GET** /margin/cross/account_book | Retrieve cross margin account change history [**listCrossMarginLoans**](MarginApi.md#listCrossMarginLoans) | **GET** /margin/cross/loans | List cross margin borrow history [**createCrossMarginLoan**](MarginApi.md#createCrossMarginLoan) | **POST** /margin/cross/loans | Create a cross margin borrow loan [**getCrossMarginLoan**](MarginApi.md#getCrossMarginLoan) | **GET** /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail [**listCrossMarginRepayments**](MarginApi.md#listCrossMarginRepayments) | **GET** /margin/cross/repayments | Retrieve cross margin repayments -[**repayCrossMarginLoan**](MarginApi.md#repayCrossMarginLoan) | **POST** /margin/cross/repayments | Repay cross margin loan +[**repayCrossMarginLoan**](MarginApi.md#repayCrossMarginLoan) | **POST** /margin/cross/repayments | Cross margin repayments +[**getCrossMarginTransferable**](MarginApi.md#getCrossMarginTransferable) | **GET** /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency +[**getCrossMarginBorrowable**](MarginApi.md#getCrossMarginBorrowable) | **GET** /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency ## listMarginCurrencyPairs @@ -159,7 +164,7 @@ $apiInstance = new GateApi\Api\MarginApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$currency = 'BTC'; // string | Retrieved specified currency related data +$currency = 'BTC'; // string | Retrieve data of the specified currency try { $result = $apiInstance->listFundingBook($currency); @@ -177,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **string**| Retrieved specified currency related data | + **currency** | **string**| Retrieve data of the specified currency | ### Return type @@ -265,7 +270,7 @@ Name | Type | Description | Notes List margin account balance change history -Only transferring from or to margin account are provided for now. Time range allows 30 days at most +Only transferals from and to margin account are provided for now. Time range allows 30 days at most ### Example @@ -285,10 +290,10 @@ $apiInstance = new GateApi\Api\MarginApi( ); $associate_array['currency'] = 'currency_example'; // string | List records related to specified currency only. If specified, `currency_pair` is also required. $associate_array['currency_pair'] = 'currency_pair_example'; // string | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided -$associate_array['from'] = 56; // int | Time range beginning, default to 7 days before current time -$associate_array['to'] = 56; // int | Time range ending, default to current time +$associate_array['from'] = 1627706330; // int | Start timestamp of the query +$associate_array['to'] = 1635329650; // int | Time range ending, default to current time $associate_array['page'] = 1; // int | Page number -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listMarginAccountBook($associate_array); @@ -310,10 +315,10 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency** | **string**| List records related to specified currency only. If specified, `currency_pair` is also required. | [optional] **currency_pair** | **string**| List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional] - **from** | **int**| Time range beginning, default to 7 days before current time | [optional] + **from** | **int**| Start timestamp of the query | [optional] **to** | **int**| Time range ending, default to current time | [optional] **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -355,7 +360,7 @@ $apiInstance = new GateApi\Api\MarginApi( new GuzzleHttp\Client(), $config ); -$associate_array['currency'] = 'BTC'; // string | Retrieved specified currency related data +$associate_array['currency'] = 'BTC'; // string | Retrieve data of the specified currency try { $result = $apiInstance->listFundingAccounts($associate_array); @@ -375,7 +380,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **string**| Retrieved specified currency related data | [optional] + **currency** | **string**| Retrieve data of the specified currency | [optional] ### Return type @@ -419,12 +424,12 @@ $apiInstance = new GateApi\Api\MarginApi( ); $associate_array['status'] = 'open'; // string | Loan status $associate_array['side'] = 'lend'; // string | Lend or borrow -$associate_array['currency'] = 'BTC'; // string | Retrieved specified currency related data +$associate_array['currency'] = 'BTC'; // string | Retrieve data of the specified currency $associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair $associate_array['sort_by'] = 'rate'; // string | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` $associate_array['reverse_sort'] = false; // bool | Whether to sort in descending order. Default to `true` $associate_array['page'] = 1; // int | Page number -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listLoans($associate_array); @@ -446,12 +451,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **status** | **string**| Loan status | **side** | **string**| Lend or borrow | - **currency** | **string**| Retrieved specified currency related data | [optional] + **currency** | **string**| Retrieve data of the specified currency | [optional] **currency_pair** | **string**| Currency pair | [optional] **sort_by** | **string**| Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` | [optional] **reverse_sort** | **bool**| Whether to sort in descending order. Default to `true` | [optional] **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -553,8 +558,8 @@ $apiInstance = new GateApi\Api\MarginApi( new GuzzleHttp\Client(), $config ); -$currency = 'BTC'; // string | Retrieved specified currency related data -$ids = '123,234,345'; // string | Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request +$currency = 'BTC'; // string | Retrieve data of the specified currency +$ids = '123,234,345'; // string | A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request try { $result = $apiInstance->mergeLoans($currency, $ids); @@ -572,8 +577,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **string**| Retrieved specified currency related data | - **ids** | **string**| Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request | + **currency** | **string**| Retrieve data of the specified currency | + **ids** | **string**| A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request | ### Return type @@ -661,7 +666,7 @@ Name | Type | Description | Notes Cancel lending loan -Only lending loans can be cancelled +Only lent loans can be cancelled ### Example @@ -680,7 +685,7 @@ $apiInstance = new GateApi\Api\MarginApi( $config ); $loan_id = '12345'; // string | Loan ID -$currency = 'BTC'; // string | Retrieved specified currency related data +$currency = 'BTC'; // string | Retrieve data of the specified currency try { $result = $apiInstance->cancelLoan($loan_id, $currency); @@ -699,7 +704,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **loan_id** | **string**| Loan ID | - **currency** | **string**| Retrieved specified currency related data | + **currency** | **string**| Retrieve data of the specified currency | ### Return type @@ -909,7 +914,7 @@ Name | Type | Description | Notes > \GateApi\Model\LoanRecord[] listLoanRecords($loan_id, $status, $page, $limit) -List repayment records of specified loan +List repayment records of a specific loan ### Example @@ -930,7 +935,7 @@ $apiInstance = new GateApi\Api\MarginApi( $associate_array['loan_id'] = '12345'; // string | Loan ID $associate_array['status'] = 'loaned'; // string | Loan record status $associate_array['page'] = 1; // int | Page number -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list try { $result = $apiInstance->listLoanRecords($associate_array); @@ -953,7 +958,7 @@ Name | Type | Description | Notes **loan_id** | **string**| Loan ID | **status** | **string**| Loan record status | [optional] **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type @@ -1215,6 +1220,134 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## getMarginTransferable + +> \GateApi\Model\MarginTransferable getMarginTransferable($currency, $currency_pair) + +Get the max transferable amount for a specific margin currency + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\MarginApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency'] = 'BTC'; // string | Retrieve data of the specified currency +$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair + +try { + $result = $apiInstance->getMarginTransferable($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling MarginApi->getMarginTransferable: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Retrieve data of the specified currency | + **currency_pair** | **string**| Currency pair | [optional] + +### Return type + +[**\GateApi\Model\MarginTransferable**](../Model/MarginTransferable.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getMarginBorrowable + +> \GateApi\Model\MarginBorrowable getMarginBorrowable($currency, $currency_pair) + +Get the max borrowable amount for a specific margin currency + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\MarginApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency'] = 'BTC'; // string | Retrieve data of the specified currency +$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair + +try { + $result = $apiInstance->getMarginBorrowable($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling MarginApi->getMarginBorrowable: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Retrieve data of the specified currency | + **currency_pair** | **string**| Currency pair | [optional] + +### Return type + +[**\GateApi\Model\MarginBorrowable**](../Model/MarginBorrowable.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listCrossMarginCurrencies > \GateApi\Model\CrossMarginCurrency[] listCrossMarginCurrencies() @@ -1379,6 +1512,80 @@ This endpoint does not need any parameter. [[Back to README]](../../README.md) +## listCrossMarginAccountBook + +> \GateApi\Model\CrossMarginAccountBook[] listCrossMarginAccountBook($currency, $from, $to, $page, $limit, $type) + +Retrieve cross margin account change history + +Record time range cannot exceed 30 days + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\MarginApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency'] = 'currency_example'; // string | Filter by currency +$associate_array['from'] = 1627706330; // int | Start timestamp of the query +$associate_array['to'] = 1635329650; // int | Time range ending, default to current time +$associate_array['page'] = 1; // int | Page number +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['type'] = 'borrow'; // string | Only retrieve changes of the specified type. All types will be returned if not specified. + +try { + $result = $apiInstance->listCrossMarginAccountBook($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling MarginApi->listCrossMarginAccountBook: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Filter by currency | [optional] + **from** | **int**| Start timestamp of the query | [optional] + **to** | **int**| Time range ending, default to current time | [optional] + **page** | **int**| Page number | [optional] [default to 1] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **type** | **string**| Only retrieve changes of the specified type. All types will be returned if not specified. | [optional] + +### Return type + +[**\GateApi\Model\CrossMarginAccountBook[]**](../Model/CrossMarginAccountBook.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listCrossMarginLoans > \GateApi\Model\CrossMarginLoan[] listCrossMarginLoans($status, $currency, $limit, $offset, $reverse) @@ -1405,7 +1612,7 @@ $apiInstance = new GateApi\Api\MarginApi( ); $associate_array['status'] = 56; // int | Filter by status. Supported values are 2 and 3. $associate_array['currency'] = 'currency_example'; // string | Filter by currency -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 $associate_array['reverse'] = true; // bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results @@ -1429,7 +1636,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **status** | **int**| Filter by status. Supported values are 2 and 3. | **currency** | **string**| Filter by currency | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **reverse** | **bool**| Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to true] @@ -1599,7 +1806,7 @@ $apiInstance = new GateApi\Api\MarginApi( ); $associate_array['currency'] = 'BTC'; // string | $associate_array['loan_id'] = '12345'; // string | -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 $associate_array['reverse'] = true; // bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results @@ -1623,7 +1830,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency** | **string**| | [optional] **loan_id** | **string**| | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **reverse** | **bool**| Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to true] @@ -1649,7 +1856,9 @@ Name | Type | Description | Notes > \GateApi\Model\CrossMarginLoan[] repayCrossMarginLoan($cross_margin_repay_request) -Repay cross margin loan +Cross margin repayments + +When the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first ### Example @@ -1704,3 +1913,123 @@ Name | Type | Description | Notes [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +## getCrossMarginTransferable + +> \GateApi\Model\CrossMarginTransferable getCrossMarginTransferable($currency) + +Get the max transferable amount for a specific cross margin currency + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\MarginApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$currency = 'BTC'; // string | Retrieve data of the specified currency + +try { + $result = $apiInstance->getCrossMarginTransferable($currency); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling MarginApi->getCrossMarginTransferable: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Retrieve data of the specified currency | + +### Return type + +[**\GateApi\Model\CrossMarginTransferable**](../Model/CrossMarginTransferable.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getCrossMarginBorrowable + +> \GateApi\Model\CrossMarginBorrowable getCrossMarginBorrowable($currency) + +Get the max borrowable amount for a specific cross margin currency + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\MarginApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$currency = 'BTC'; // string | Retrieve data of the specified currency + +try { + $result = $apiInstance->getCrossMarginBorrowable($currency); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling MarginApi->getCrossMarginBorrowable: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Retrieve data of the specified currency | + +### Return type + +[**\GateApi\Model\CrossMarginBorrowable**](../Model/CrossMarginBorrowable.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Api/OptionsApi.md b/docs/Api/OptionsApi.md new file mode 100644 index 0000000..021bb87 --- /dev/null +++ b/docs/Api/OptionsApi.md @@ -0,0 +1,1533 @@ +# GateApi\OptionsApi + +All URIs are relative to *https://api.gateio.ws/api/v4* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**listOptionsUnderlyings**](OptionsApi.md#listOptionsUnderlyings) | **GET** /options/underlyings | List all underlyings +[**listOptionsExpirations**](OptionsApi.md#listOptionsExpirations) | **GET** /options/expirations | List all expiration times +[**listOptionsContracts**](OptionsApi.md#listOptionsContracts) | **GET** /options/contracts | List all the contracts with specified underlying and expiration time +[**getOptionsContract**](OptionsApi.md#getOptionsContract) | **GET** /options/contracts/{contract} | Query specified contract detail +[**listOptionsSettlements**](OptionsApi.md#listOptionsSettlements) | **GET** /options/settlements | List settlement history +[**getOptionsSettlement**](OptionsApi.md#getOptionsSettlement) | **GET** /options/settlements/{contract} | Get specified contract's settlement +[**listMyOptionsSettlements**](OptionsApi.md#listMyOptionsSettlements) | **GET** /options/my_settlements | List my options settlements +[**listOptionsOrderBook**](OptionsApi.md#listOptionsOrderBook) | **GET** /options/order_book | Options order book +[**listOptionsTickers**](OptionsApi.md#listOptionsTickers) | **GET** /options/tickers | List tickers of options contracts +[**listOptionsUnderlyingTickers**](OptionsApi.md#listOptionsUnderlyingTickers) | **GET** /options/underlying/tickers/{underlying} | Get underlying ticker +[**listOptionsCandlesticks**](OptionsApi.md#listOptionsCandlesticks) | **GET** /options/candlesticks | Get options candlesticks +[**listOptionsUnderlyingCandlesticks**](OptionsApi.md#listOptionsUnderlyingCandlesticks) | **GET** /options/underlying/candlesticks | Mark price candlesticks of an underlying +[**listOptionsTrades**](OptionsApi.md#listOptionsTrades) | **GET** /options/trades | Options trade history +[**listOptionsAccount**](OptionsApi.md#listOptionsAccount) | **GET** /options/accounts | List options account +[**listOptionsAccountBook**](OptionsApi.md#listOptionsAccountBook) | **GET** /options/account_book | List account changing history +[**listOptionsPositions**](OptionsApi.md#listOptionsPositions) | **GET** /options/positions | List user's positions of specified underlying +[**getOptionsPosition**](OptionsApi.md#getOptionsPosition) | **GET** /options/positions/{contract} | Get specified contract position +[**listOptionsPositionClose**](OptionsApi.md#listOptionsPositionClose) | **GET** /options/position_close | List user's liquidation history of specified underlying +[**listOptionsOrders**](OptionsApi.md#listOptionsOrders) | **GET** /options/orders | List options orders +[**createOptionsOrder**](OptionsApi.md#createOptionsOrder) | **POST** /options/orders | Create an options order +[**cancelOptionsOrders**](OptionsApi.md#cancelOptionsOrders) | **DELETE** /options/orders | Cancel all `open` orders matched +[**getOptionsOrder**](OptionsApi.md#getOptionsOrder) | **GET** /options/orders/{order_id} | Get a single order +[**cancelOptionsOrder**](OptionsApi.md#cancelOptionsOrder) | **DELETE** /options/orders/{order_id} | Cancel a single order +[**listMyOptionsTrades**](OptionsApi.md#listMyOptionsTrades) | **GET** /options/my_trades | List personal trading history + + +## listOptionsUnderlyings + +> \GateApi\Model\OptionsUnderlying[] listOptionsUnderlyings() + +List all underlyings + +### Example + +```php +listOptionsUnderlyings(); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsUnderlyings: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\GateApi\Model\OptionsUnderlying[]**](../Model/OptionsUnderlying.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsExpirations + +> int[] listOptionsExpirations($underlying) + +List all expiration times + +### Example + +```php +listOptionsExpirations($underlying); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsExpirations: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + +### Return type + +**int[]** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsContracts + +> \GateApi\Model\OptionsContract[] listOptionsContracts($underlying, $expiration) + +List all the contracts with specified underlying and expiration time + +### Example + +```php +listOptionsContracts($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsContracts: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **expiration** | **int**| Unix timestamp of the expiration time | [optional] + +### Return type + +[**\GateApi\Model\OptionsContract[]**](../Model/OptionsContract.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getOptionsContract + +> \GateApi\Model\OptionsContract getOptionsContract($contract) + +Query specified contract detail + +### Example + +```php +getOptionsContract($contract); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->getOptionsContract: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| | + +### Return type + +[**\GateApi\Model\OptionsContract**](../Model/OptionsContract.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsSettlements + +> \GateApi\Model\OptionsSettlement[] listOptionsSettlements($underlying, $limit, $offset, $from, $to) + +List settlement history + +### Example + +```php +listOptionsSettlements($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsSettlements: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + +### Return type + +[**\GateApi\Model\OptionsSettlement[]**](../Model/OptionsSettlement.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getOptionsSettlement + +> \GateApi\Model\OptionsSettlement getOptionsSettlement($contract, $underlying, $at) + +Get specified contract's settlement + +### Example + +```php +getOptionsSettlement($contract, $underlying, $at); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->getOptionsSettlement: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| | + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **at** | **int**| | + +### Return type + +[**\GateApi\Model\OptionsSettlement**](../Model/OptionsSettlement.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listMyOptionsSettlements + +> \GateApi\Model\OptionsMySettlements[] listMyOptionsSettlements($underlying, $contract, $limit, $offset, $from, $to) + +List my options settlements + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying (Obtained by listing underlying endpoint) +$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Options contract name +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 +$associate_array['from'] = 1547706332; // int | Start timestamp +$associate_array['to'] = 1547706332; // int | End timestamp + +try { + $result = $apiInstance->listMyOptionsSettlements($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listMyOptionsSettlements: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **contract** | **string**| Options contract name | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + +### Return type + +[**\GateApi\Model\OptionsMySettlements[]**](../Model/OptionsMySettlements.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsOrderBook + +> \GateApi\Model\FuturesOrderBook listOptionsOrderBook($contract, $interval, $limit, $with_id) + +Options order book + +Bids will be sorted by price from high to low, while asks sorted reversely + +### Example + +```php +listOptionsOrderBook($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsOrderBook: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| Options contract name | + **interval** | **string**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] + **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] + **with_id** | **bool**| Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [optional] [default to false] + +### Return type + +[**\GateApi\Model\FuturesOrderBook**](../Model/FuturesOrderBook.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsTickers + +> \GateApi\Model\OptionsTicker[] listOptionsTickers($underlying) + +List tickers of options contracts + +### Example + +```php +listOptionsTickers($underlying); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsTickers: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + +### Return type + +[**\GateApi\Model\OptionsTicker[]**](../Model/OptionsTicker.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsUnderlyingTickers + +> \GateApi\Model\OptionsUnderlyingTicker listOptionsUnderlyingTickers($underlying) + +Get underlying ticker + +### Example + +```php +listOptionsUnderlyingTickers($underlying); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsUnderlyingTickers: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying | + +### Return type + +[**\GateApi\Model\OptionsUnderlyingTicker**](../Model/OptionsUnderlyingTicker.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsCandlesticks + +> \GateApi\Model\OptionsCandlestick[] listOptionsCandlesticks($contract, $limit, $from, $to, $interval) + +Get options candlesticks + +### Example + +```php +listOptionsCandlesticks($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsCandlesticks: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| Options contract name | + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + **interval** | **string**| Interval time between data points | [optional] [default to '5m'] + +### Return type + +[**\GateApi\Model\OptionsCandlestick[]**](../Model/OptionsCandlestick.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsUnderlyingCandlesticks + +> \GateApi\Model\FuturesCandlestick[] listOptionsUnderlyingCandlesticks($underlying, $limit, $from, $to, $interval) + +Mark price candlesticks of an underlying + +### Example + +```php +listOptionsUnderlyingCandlesticks($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsUnderlyingCandlesticks: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + **interval** | **string**| Interval time between data points | [optional] [default to '5m'] + +### Return type + +[**\GateApi\Model\FuturesCandlestick[]**](../Model/FuturesCandlestick.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsTrades + +> \GateApi\Model\FuturesTrade[] listOptionsTrades($contract, $type, $limit, $offset, $from, $to) + +Options trade history + +### Example + +```php +listOptionsTrades($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsTrades: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| Options contract name | [optional] + **type** | **string**| `C` is call, while `P` is put | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + +### Return type + +[**\GateApi\Model\FuturesTrade[]**](../Model/FuturesTrade.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsAccount + +> \GateApi\Model\OptionsAccount listOptionsAccount() + +List options account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->listOptionsAccount(); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsAccount: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\GateApi\Model\OptionsAccount**](../Model/OptionsAccount.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsAccountBook + +> \GateApi\Model\OptionsAccountBook[] listOptionsAccountBook($limit, $offset, $from, $to, $type) + +List account changing history + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 +$associate_array['from'] = 1547706332; // int | Start timestamp +$associate_array['to'] = 1547706332; // int | End timestamp +$associate_array['type'] = 'dnw'; // string | Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL + +try { + $result = $apiInstance->listOptionsAccountBook($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsAccountBook: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + **type** | **string**| Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL | [optional] + +### Return type + +[**\GateApi\Model\OptionsAccountBook[]**](../Model/OptionsAccountBook.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsPositions + +> \GateApi\Model\OptionsPosition[] listOptionsPositions($underlying) + +List user's positions of specified underlying + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying + +try { + $result = $apiInstance->listOptionsPositions($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsPositions: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying | [optional] + +### Return type + +[**\GateApi\Model\OptionsPosition[]**](../Model/OptionsPosition.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getOptionsPosition + +> \GateApi\Model\OptionsPosition getOptionsPosition($contract) + +Get specified contract position + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$contract = 'BTC_USDT-20211130-65000-C'; // string | + +try { + $result = $apiInstance->getOptionsPosition($contract); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->getOptionsPosition: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| | + +### Return type + +[**\GateApi\Model\OptionsPosition**](../Model/OptionsPosition.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsPositionClose + +> \GateApi\Model\OptionsPositionClose[] listOptionsPositionClose($underlying, $contract) + +List user's liquidation history of specified underlying + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying (Obtained by listing underlying endpoint) +$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Options contract name + +try { + $result = $apiInstance->listOptionsPositionClose($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsPositionClose: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **contract** | **string**| Options contract name | [optional] + +### Return type + +[**\GateApi\Model\OptionsPositionClose[]**](../Model/OptionsPositionClose.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listOptionsOrders + +> \GateApi\Model\OptionsOrder[] listOptionsOrders($status, $contract, $underlying, $limit, $offset, $from, $to) + +List options orders + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['status'] = 'open'; // string | Only list the orders with this status +$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Options contract name +$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 +$associate_array['from'] = 1547706332; // int | Start timestamp +$associate_array['to'] = 1547706332; // int | End timestamp + +try { + $result = $apiInstance->listOptionsOrders($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listOptionsOrders: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **string**| Only list the orders with this status | + **contract** | **string**| Options contract name | [optional] + **underlying** | **string**| Underlying | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + +### Return type + +[**\GateApi\Model\OptionsOrder[]**](../Model/OptionsOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## createOptionsOrder + +> \GateApi\Model\OptionsOrder createOptionsOrder($options_order) + +Create an options order + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$options_order = new \GateApi\Model\OptionsOrder(); // \GateApi\Model\OptionsOrder | + +try { + $result = $apiInstance->createOptionsOrder($options_order); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->createOptionsOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **options_order** | [**\GateApi\Model\OptionsOrder**](../Model/OptionsOrder.md)| | + +### Return type + +[**\GateApi\Model\OptionsOrder**](../Model/OptionsOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## cancelOptionsOrders + +> \GateApi\Model\OptionsOrder[] cancelOptionsOrders($contract, $underlying, $side) + +Cancel all `open` orders matched + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$contract = 'BTC_USDT-20210916-5000-C'; // string | Options contract name +$underlying = 'BTC_USDT'; // string | Underlying +$side = 'ask'; // string | All bids or asks. Both included if not specified + +try { + $result = $apiInstance->cancelOptionsOrders($contract, $underlying, $side); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->cancelOptionsOrders: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contract** | **string**| Options contract name | [optional] + **underlying** | **string**| Underlying | [optional] + **side** | **string**| All bids or asks. Both included if not specified | [optional] + +### Return type + +[**\GateApi\Model\OptionsOrder[]**](../Model/OptionsOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getOptionsOrder + +> \GateApi\Model\OptionsOrder getOptionsOrder($order_id) + +Get a single order + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$order_id = 12345; // int | Order ID returned on successful order creation + +try { + $result = $apiInstance->getOptionsOrder($order_id); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->getOptionsOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| Order ID returned on successful order creation | + +### Return type + +[**\GateApi\Model\OptionsOrder**](../Model/OptionsOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## cancelOptionsOrder + +> \GateApi\Model\OptionsOrder cancelOptionsOrder($order_id) + +Cancel a single order + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$order_id = 12345; // int | Order ID returned on successful order creation + +try { + $result = $apiInstance->cancelOptionsOrder($order_id); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->cancelOptionsOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| Order ID returned on successful order creation | + +### Return type + +[**\GateApi\Model\OptionsOrder**](../Model/OptionsOrder.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listMyOptionsTrades + +> \GateApi\Model\OptionsMyTrade[] listMyOptionsTrades($underlying, $contract, $limit, $offset, $from, $to) + +List personal trading history + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\OptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying (Obtained by listing underlying endpoint) +$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Options contract name +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 +$associate_array['from'] = 1547706332; // int | Start timestamp +$associate_array['to'] = 1547706332; // int | End timestamp + +try { + $result = $apiInstance->listMyOptionsTrades($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling OptionsApi->listMyOptionsTrades: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **underlying** | **string**| Underlying (Obtained by listing underlying endpoint) | + **contract** | **string**| Options contract name | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + +### Return type + +[**\GateApi\Model\OptionsMyTrade[]**](../Model/OptionsMyTrade.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Api/RebateApi.md b/docs/Api/RebateApi.md new file mode 100644 index 0000000..6eb17c0 --- /dev/null +++ b/docs/Api/RebateApi.md @@ -0,0 +1,157 @@ +# GateApi\RebateApi + +All URIs are relative to *https://api.gateio.ws/api/v4* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**agencyTransactionHistory**](RebateApi.md#agencyTransactionHistory) | **GET** /rebate/agency/transaction_history | The broker obtains the transaction history of the recommended user +[**agencyCommissionsHistory**](RebateApi.md#agencyCommissionsHistory) | **GET** /rebate/agency/commission_history | The broker obtains the commission history of the recommended user + + +## agencyTransactionHistory + +> \GateApi\Model\AgencyTransactionHistory[] agencyTransactionHistory($currency_pair, $user_id, $from, $to, $limit, $offset) + +The broker obtains the transaction history of the recommended user + +Record time range cannot exceed 30 days + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\RebateApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency_pair'] = 'BTC_USDT'; // string | Specify the currency pair, if not specified, return all currency pairs +$associate_array['user_id'] = '10003'; // string | User ID. If not specified, all user records will be returned +$associate_array['from'] = 1602120000; // int | Time range beginning, default to 7 days before current time +$associate_array['to'] = 1602123600; // int | Time range ending, default to current time +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 + +try { + $result = $apiInstance->agencyTransactionHistory($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling RebateApi->agencyTransactionHistory: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency_pair** | **string**| Specify the currency pair, if not specified, return all currency pairs | [optional] + **user_id** | **string**| User ID. If not specified, all user records will be returned | [optional] + **from** | **int**| Time range beginning, default to 7 days before current time | [optional] + **to** | **int**| Time range ending, default to current time | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + +### Return type + +[**\GateApi\Model\AgencyTransactionHistory[]**](../Model/AgencyTransactionHistory.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## agencyCommissionsHistory + +> \GateApi\Model\AgencyCommissionHistory[] agencyCommissionsHistory($currency, $user_id, $from, $to, $limit, $offset) + +The broker obtains the commission history of the recommended user + +Record time range cannot exceed 30 days + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\RebateApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency'] = 'BTC'; // string | Filter by currency. Return all currency records if not specified +$associate_array['user_id'] = '10003'; // string | User ID. If not specified, all user records will be returned +$associate_array['from'] = 1602120000; // int | Time range beginning, default to 7 days before current time +$associate_array['to'] = 1602123600; // int | Time range ending, default to current time +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list +$associate_array['offset'] = 0; // int | List offset, starting from 0 + +try { + $result = $apiInstance->agencyCommissionsHistory($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling RebateApi->agencyCommissionsHistory: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Filter by currency. Return all currency records if not specified | [optional] + **user_id** | **string**| User ID. If not specified, all user records will be returned | [optional] + **from** | **int**| Time range beginning, default to 7 days before current time | [optional] + **to** | **int**| Time range ending, default to current time | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + +### Return type + +[**\GateApi\Model\AgencyCommissionHistory[]**](../Model/AgencyCommissionHistory.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Api/SpotApi.md b/docs/Api/SpotApi.md index 444cb32..b95d58b 100644 --- a/docs/Api/SpotApi.md +++ b/docs/Api/SpotApi.md @@ -4,37 +4,44 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- -[**listCurrencies**](SpotApi.md#listCurrencies) | **GET** /spot/currencies | List all currencies' detail -[**getCurrency**](SpotApi.md#getCurrency) | **GET** /spot/currencies/{currency} | Get detail of one particular currency +[**listCurrencies**](SpotApi.md#listCurrencies) | **GET** /spot/currencies | List all currencies' details +[**getCurrency**](SpotApi.md#getCurrency) | **GET** /spot/currencies/{currency} | Get details of a specific currency [**listCurrencyPairs**](SpotApi.md#listCurrencyPairs) | **GET** /spot/currency_pairs | List all currency pairs supported -[**getCurrencyPair**](SpotApi.md#getCurrencyPair) | **GET** /spot/currency_pairs/{currency_pair} | Get detail of one single order +[**getCurrencyPair**](SpotApi.md#getCurrencyPair) | **GET** /spot/currency_pairs/{currency_pair} | Get details of a specifc currency pair [**listTickers**](SpotApi.md#listTickers) | **GET** /spot/tickers | Retrieve ticker information [**listOrderBook**](SpotApi.md#listOrderBook) | **GET** /spot/order_book | Retrieve order book [**listTrades**](SpotApi.md#listTrades) | **GET** /spot/trades | Retrieve market trades [**listCandlesticks**](SpotApi.md#listCandlesticks) | **GET** /spot/candlesticks | Market candlesticks [**getFee**](SpotApi.md#getFee) | **GET** /spot/fee | Query user trading fee rates +[**getBatchSpotFee**](SpotApi.md#getBatchSpotFee) | **GET** /spot/batch_fee | Query a batch of user trading fee rates [**listSpotAccounts**](SpotApi.md#listSpotAccounts) | **GET** /spot/accounts | List spot accounts [**createBatchOrders**](SpotApi.md#createBatchOrders) | **POST** /spot/batch_orders | Create a batch of orders [**listAllOpenOrders**](SpotApi.md#listAllOpenOrders) | **GET** /spot/open_orders | List all open orders +[**createCrossLiquidateOrder**](SpotApi.md#createCrossLiquidateOrder) | **POST** /spot/cross_liquidate_orders | close position when cross-currency is disabled [**listOrders**](SpotApi.md#listOrders) | **GET** /spot/orders | List orders [**createOrder**](SpotApi.md#createOrder) | **POST** /spot/orders | Create an order [**cancelOrders**](SpotApi.md#cancelOrders) | **DELETE** /spot/orders | Cancel all `open` orders in specified currency pair [**cancelBatchOrders**](SpotApi.md#cancelBatchOrders) | **POST** /spot/cancel_batch_orders | Cancel a batch of orders with an ID list [**getOrder**](SpotApi.md#getOrder) | **GET** /spot/orders/{order_id} | Get a single order [**cancelOrder**](SpotApi.md#cancelOrder) | **DELETE** /spot/orders/{order_id} | Cancel a single order +[**amendOrder**](SpotApi.md#amendOrder) | **PATCH** /spot/orders/{order_id} | Amend an order [**listMyTrades**](SpotApi.md#listMyTrades) | **GET** /spot/my_trades | List personal trading history +[**getSystemTime**](SpotApi.md#getSystemTime) | **GET** /spot/time | Get server current time +[**countdownCancelAllSpot**](SpotApi.md#countdownCancelAllSpot) | **POST** /spot/countdown_cancel_all | Countdown cancel orders [**listSpotPriceTriggeredOrders**](SpotApi.md#listSpotPriceTriggeredOrders) | **GET** /spot/price_orders | Retrieve running auto order list [**createSpotPriceTriggeredOrder**](SpotApi.md#createSpotPriceTriggeredOrder) | **POST** /spot/price_orders | Create a price-triggered order [**cancelSpotPriceTriggeredOrderList**](SpotApi.md#cancelSpotPriceTriggeredOrderList) | **DELETE** /spot/price_orders | Cancel all open orders -[**getSpotPriceTriggeredOrder**](SpotApi.md#getSpotPriceTriggeredOrder) | **GET** /spot/price_orders/{order_id} | Get a single order -[**cancelSpotPriceTriggeredOrder**](SpotApi.md#cancelSpotPriceTriggeredOrder) | **DELETE** /spot/price_orders/{order_id} | Cancel a single order +[**getSpotPriceTriggeredOrder**](SpotApi.md#getSpotPriceTriggeredOrder) | **GET** /spot/price_orders/{order_id} | Get a price-triggered order +[**cancelSpotPriceTriggeredOrder**](SpotApi.md#cancelSpotPriceTriggeredOrder) | **DELETE** /spot/price_orders/{order_id} | cancel a price-triggered order ## listCurrencies > \GateApi\Model\Currency[] listCurrencies() -List all currencies' detail +List all currencies' details + +Currency has two forms: 1. Only currency name, e.g., BTC, USDT 2. `_`, e.g., `HT_ETH` The latter one occurs when one currency has multiple chains. Currency detail contains a `chain` field whatever the form is. To retrieve all chains of one currency, you can use use all the details which has the name of the currency or name starting with `_`. ### Example @@ -86,7 +93,7 @@ No authorization required > \GateApi\Model\Currency getCurrency($currency) -Get detail of one particular currency +Get details of a specific currency ### Example @@ -194,7 +201,7 @@ No authorization required > \GateApi\Model\CurrencyPair getCurrencyPair($currency_pair) -Get detail of one single order +Get details of a specifc currency pair ### Example @@ -248,7 +255,7 @@ No authorization required ## listTickers -> \GateApi\Model\Ticker[] listTickers($currency_pair) +> \GateApi\Model\Ticker[] listTickers($currency_pair, $timezone) Retrieve ticker information @@ -267,6 +274,7 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client() ); $associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair +$associate_array['timezone'] = 'utc0'; // string | Timezone try { $result = $apiInstance->listTickers($associate_array); @@ -287,6 +295,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **string**| Currency pair | [optional] + **timezone** | **string**| Timezone | [optional] ### Return type @@ -312,7 +321,7 @@ No authorization required Retrieve order book -Order book will be sorted by price from high to low on bids; reversed on asks +Order book will be sorted by price from high to low on bids; low to high on asks ### Example @@ -374,10 +383,12 @@ No authorization required ## listTrades -> \GateApi\Model\Trade[] listTrades($currency_pair, $limit, $last_id, $reverse) +> \GateApi\Model\Trade[] listTrades($currency_pair, $limit, $last_id, $reverse, $from, $to, $page) Retrieve market trades +You can use `from` and `to` to query by time range, or use `last_id` by scrolling page. The default behavior is by time range. Scrolling query using `last_id` is not recommended any more. If `last_id` is specified, time range query parameters will be ignored. + ### Example ```php @@ -391,9 +402,12 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client() ); $associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 $associate_array['last_id'] = '12345'; // string | Specify list staring point using the `id` of last record in previous list-query results -$associate_array['reverse'] = false; // bool | Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. +$associate_array['reverse'] = false; // bool | Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. +$associate_array['from'] = 1627706330; // int | Start timestamp of the query +$associate_array['to'] = 1635329650; // int | Time range ending, default to current time +$associate_array['page'] = 1; // int | Page number try { $result = $apiInstance->listTrades($associate_array); @@ -414,9 +428,12 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **string**| Currency pair | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 | [optional] [default to 100] **last_id** | **string**| Specify list staring point using the `id` of last record in previous list-query results | [optional] - **reverse** | **bool**| Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. | [optional] [default to false] + **reverse** | **bool**| Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. | [optional] [default to false] + **from** | **int**| Start timestamp of the query | [optional] + **to** | **int**| Time range ending, default to current time | [optional] + **page** | **int**| Page number | [optional] [default to 1] ### Return type @@ -442,7 +459,7 @@ No authorization required Market candlesticks -Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` +Maximum of 1000 points can be returned in a query. Be sure not to exceed the limit when specifying from, to and interval ### Example @@ -457,10 +474,10 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client() ); $associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair -$associate_array['limit'] = 100; // int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. +$associate_array['limit'] = 100; // int | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. $associate_array['from'] = 1546905600; // int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified $associate_array['to'] = 1546935600; // int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time -$associate_array['interval'] = '30m'; // string | Interval time between data points +$associate_array['interval'] = '30m'; // string | Interval time between data points. Note that `30d` means 1 natual month, not 30 days try { $result = $apiInstance->listCandlesticks($associate_array); @@ -481,10 +498,10 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **string**| Currency pair | - **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **limit** | **int**| Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] **from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] - **interval** | **string**| Interval time between data points | [optional] [default to '30m'] + **interval** | **string**| Interval time between data points. Note that `30d` means 1 natual month, not 30 days | [optional] [default to '30m'] ### Return type @@ -568,6 +585,66 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## getBatchSpotFee + +> map[string,\GateApi\Model\SpotFee] getBatchSpotFee($currency_pairs) + +Query a batch of user trading fee rates + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SpotApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$currency_pairs = 'BTC_USDT,ETH_USDT'; // string | A request can only query up to 50 currency pairs + +try { + $result = $apiInstance->getBatchSpotFee($currency_pairs); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SpotApi->getBatchSpotFee: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency_pairs** | **string**| A request can only query up to 50 currency pairs | + +### Return type + +[**map[string,\GateApi\Model\SpotFee]**](../Model/SpotFee.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listSpotAccounts > \GateApi\Model\SpotAccount[] listSpotAccounts($currency) @@ -590,7 +667,7 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$associate_array['currency'] = 'BTC'; // string | Retrieved specified currency related data +$associate_array['currency'] = 'BTC'; // string | Retrieve data of the specified currency try { $result = $apiInstance->listSpotAccounts($associate_array); @@ -610,7 +687,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **string**| Retrieved specified currency related data | [optional] + **currency** | **string**| Retrieve data of the specified currency | [optional] ### Return type @@ -718,7 +795,7 @@ $apiInstance = new GateApi\Api\SpotApi( ); $associate_array['page'] = 1; // int | Page number $associate_array['limit'] = 100; // int | Maximum number of records returned in one page in each currency pair -$associate_array['account'] = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account +$associate_array['account'] = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only try { $result = $apiInstance->listAllOpenOrders($associate_array); @@ -740,7 +817,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **page** | **int**| Page number | [optional] [default to 1] **limit** | **int**| Maximum number of records returned in one page in each currency pair | [optional] [default to 100] - **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] + **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | [optional] ### Return type @@ -760,13 +837,75 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## createCrossLiquidateOrder + +> \GateApi\Model\Order createCrossLiquidateOrder($liquidate_order) + +close position when cross-currency is disabled + +Currently, only cross-margin accounts are supported to close position when cross currencies are disabled. Maximum buy quantity = (unpaid principal and interest - currency balance - the amount of the currency in the order book) / 0.998 + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SpotApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$liquidate_order = new \GateApi\Model\LiquidateOrder(); // \GateApi\Model\LiquidateOrder | + +try { + $result = $apiInstance->createCrossLiquidateOrder($liquidate_order); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SpotApi->createCrossLiquidateOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **liquidate_order** | [**\GateApi\Model\LiquidateOrder**](../Model/LiquidateOrder.md)| | + +### Return type + +[**\GateApi\Model\Order**](../Model/Order.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listOrders -> \GateApi\Model\Order[] listOrders($currency_pair, $status, $page, $limit, $account) +> \GateApi\Model\Order[] listOrders($currency_pair, $status, $page, $limit, $account, $from, $to, $side) List orders -Spot and margin orders are returned by default. If cross margin orders are needed, `account` must be set to `cross_margin` +Spot and margin orders are returned by default. If cross margin orders are needed, `account` must be set to `cross_margin` When `status` is `open`, i.e., listing open orders, only pagination parameters `page` and `limit` are supported and `limit` cannot be larger than 100. Query by `side` and time range parameters `from` and `to` are not supported. When `status` is `finished`, i.e., listing finished orders, pagination parameters, time range parameters `from` and `to`, and `side` parameters are all supported. Time range parameters are handled as order finish time. ### Example @@ -784,11 +923,14 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair +$associate_array['currency_pair'] = 'BTC_USDT'; // string | Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. $associate_array['status'] = 'open'; // string | List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled $associate_array['page'] = 1; // int | Page number -$associate_array['limit'] = 100; // int | Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 -$associate_array['account'] = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account +$associate_array['limit'] = 100; // int | Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 +$associate_array['account'] = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only +$associate_array['from'] = 1627706330; // int | Start timestamp of the query +$associate_array['to'] = 1635329650; // int | Time range ending, default to current time +$associate_array['side'] = 'sell'; // string | All bids or asks. Both included if not specified try { $result = $apiInstance->listOrders($associate_array); @@ -808,11 +950,14 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **string**| Currency pair | + **currency_pair** | **string**| Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. | **status** | **string**| List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled | **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 | [optional] [default to 100] - **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] + **limit** | **int**| Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 | [optional] [default to 100] + **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | [optional] + **from** | **int**| Start timestamp of the query | [optional] + **to** | **int**| Time range ending, default to current time | [optional] + **side** | **string**| All bids or asks. Both included if not specified | [optional] ### Return type @@ -838,7 +983,7 @@ Name | Type | Description | Notes Create an order -You can place orders with spot, margin or cross margin account through setting the `account `field. It defaults to `spot`, which means spot account is used to place orders. When margin account is used, i.e., `account` is `margin`, `auto_borrow` field can be set to `true` to enable the server to borrow the amount lacked using `POST /margin/loans` when your account's balance is not enough. Whether margin orders' fill will be used to repay margin loans automatically is determined by the auto repayment setting in your **margin account**, which can be updated or queried using `/margin/auto_repay` API. When cross margin account is used, i.e., `account` is `cross_margin`, `auto_borrow` can also be enabled to achieve borrowing the insufficient amount automatically if cross account's balance is not enough. But it differs from margin account that automatic repayment is determined by order's `auto_repay` field and only current order's fill will be used to repay cross margin loans. Automatic repayment will be triggered when the order is finished, i.e., its status is either `cancelled` or `closed`. **Order status** An order waiting to be filled is `open`, and it stays `open` until it is filled totally. If fully filled, order is finished and its status turns to `closed`.If the order is cancelled before it is totally filled, whether or not partially filled, its status is `cancelled`. **Iceberg order** `iceberg` field can be used to set the amount shown. Set to `-1` to hide totally. Note that the hidden part's fee will be charged using taker's fee rate. +You can place orders with spot, margin or cross margin account through setting the `account `field. It defaults to `spot`, which means spot account is used to place orders. When margin account is used, i.e., `account` is `margin`, `auto_borrow` field can be set to `true` to enable the server to borrow the amount lacked using `POST /margin/loans` when your account's balance is not enough. Whether margin orders' fill will be used to repay margin loans automatically is determined by the auto repayment setting in your **margin account**, which can be updated or queried using `/margin/auto_repay` API. When cross margin account is used, i.e., `account` is `cross_margin`, `auto_borrow` can also be enabled to achieve borrowing the insufficient amount automatically if cross account's balance is not enough. But it differs from margin account that automatic repayment is determined by order's `auto_repay` field and only current order's fill will be used to repay cross margin loans. Automatic repayment will be triggered when the order is finished, i.e., its status is either `cancelled` or `closed`. **Order status** An order waiting to be filled is `open`, and it stays `open` until it is filled totally. If fully filled, order is finished and its status turns to `closed`.If the order is cancelled before it is totally filled, whether or not partially filled, its status is `cancelled`. **Iceberg order** `iceberg` field can be used to set the amount shown. Set to `-1` to hide the order completely. Note that the hidden part's fee will be charged using taker's fee rate. ### Example @@ -919,8 +1064,8 @@ $apiInstance = new GateApi\Api\SpotApi( $config ); $currency_pair = 'BTC_USDT'; // string | Currency pair -$side = 'sell'; // string | All bids or asks. Both included in not specified -$account = 'spot'; // string | Specify account type. Default to all account types being included +$side = 'sell'; // string | All bids or asks. Both included if not specified +$account = 'spot'; // string | Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only try { $result = $apiInstance->cancelOrders($currency_pair, $side, $account); @@ -939,8 +1084,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **string**| Currency pair | - **side** | **string**| All bids or asks. Both included in not specified | [optional] - **account** | **string**| Specify account type. Default to all account types being included | [optional] + **side** | **string**| All bids or asks. Both included if not specified | [optional] + **account** | **string**| Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only | [optional] ### Return type @@ -1028,7 +1173,7 @@ Name | Type | Description | Notes Get a single order -Spot and margin orders are queried by default. If cross margin orders are needed, `account` must be set to `cross_margin` +Spot and margin orders are queried by default. If cross margin orders are needed or portfolio margin account are used, account must be set to cross_margin. ### Example @@ -1046,9 +1191,9 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. +$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. $currency_pair = 'BTC_USDT'; // string | Currency pair -$account = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account +$account = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only try { $result = $apiInstance->getOrder($order_id, $currency_pair, $account); @@ -1066,9 +1211,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. | + **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. | **currency_pair** | **string**| Currency pair | - **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] + **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | [optional] ### Return type @@ -1094,7 +1239,7 @@ Name | Type | Description | Notes Cancel a single order -Spot and margin orders are cancelled by default. If trying to cancel cross margin orders, `account` must be set to `cross_margin` +Spot and margin orders are cancelled by default. If trying to cancel cross margin orders or portfolio margin account are used, account must be set to cross_margin ### Example @@ -1112,9 +1257,9 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. +$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. $currency_pair = 'BTC_USDT'; // string | Currency pair -$account = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account +$account = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only try { $result = $apiInstance->cancelOrder($order_id, $currency_pair, $account); @@ -1132,9 +1277,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. | + **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. | **currency_pair** | **string**| Currency pair | - **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] + **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | [optional] ### Return type @@ -1154,13 +1299,81 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## amendOrder + +> \GateApi\Model\Order amendOrder($order_id, $currency_pair, $order_patch, $account) + +Amend an order + +By default, the orders of spot and margin account are updated. If you need to modify orders of the `cross-margin` account, you must specify account as `cross_margin`. For portfolio margin account, only `cross_margin` account is supported. Currently, only supports modification of `price` or `amount` fields. Regarding rate limiting: modify order and create order sharing rate limiting rules. Regarding matching priority: only modifying the amount does not affect the priority. If the price is modified, the priority will be adjusted to the last of the new price. Note: If the modified amount is less than the fill amount, the order will be cancelled. + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SpotApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$order_id = '12345'; // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. +$currency_pair = 'BTC_USDT'; // string | Currency pair +$order_patch = new \GateApi\Model\OrderPatch(); // \GateApi\Model\OrderPatch | +$account = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only + +try { + $result = $apiInstance->amendOrder($order_id, $currency_pair, $order_patch, $account); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SpotApi->amendOrder: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **string**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. | + **currency_pair** | **string**| Currency pair | + **order_patch** | [**\GateApi\Model\OrderPatch**](../Model/OrderPatch.md)| | + **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | [optional] + +### Return type + +[**\GateApi\Model\Order**](../Model/Order.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listMyTrades -> \GateApi\Model\Trade[] listMyTrades($currency_pair, $limit, $page, $order_id, $account) +> \GateApi\Model\Trade[] listMyTrades($currency_pair, $limit, $page, $order_id, $account, $from, $to) List personal trading history -Spot and margin trades are queried by default. If cross margin trades are needed, `account` must be set to `cross_margin` +Spot and margin trades are queried by default. If cross margin trades are needed, `account` must be set to `cross_margin` You can also set `from` and(or) `to` to query by time range. If you don't specify `from` and/or `to` parameters, only the last 7 days of data will be retured. The range of `from` and `to` is not alloed to exceed 30 days. Time range parameters are handled as order finish time. ### Example @@ -1178,11 +1391,13 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['currency_pair'] = 'BTC_USDT'; // string | Retrieve results with specified currency pair +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['page'] = 1; // int | Page number -$associate_array['order_id'] = '12345'; // string | List all trades of specified order -$associate_array['account'] = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account +$associate_array['order_id'] = '12345'; // string | Filter trades with specified order ID. `currency_pair` is also required if this field is present +$associate_array['account'] = 'cross_margin'; // string | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only +$associate_array['from'] = 1627706330; // int | Start timestamp of the query +$associate_array['to'] = 1635329650; // int | Time range ending, default to current time try { $result = $apiInstance->listMyTrades($associate_array); @@ -1202,11 +1417,13 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **string**| Currency pair | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **currency_pair** | **string**| Retrieve results with specified currency pair | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **page** | **int**| Page number | [optional] [default to 1] - **order_id** | **string**| List all trades of specified order | [optional] - **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] + **order_id** | **string**| Filter trades with specified order ID. `currency_pair` is also required if this field is present | [optional] + **account** | **string**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | [optional] + **from** | **int**| Start timestamp of the query | [optional] + **to** | **int**| Time range ending, default to current time | [optional] ### Return type @@ -1226,6 +1443,120 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## getSystemTime + +> \GateApi\Model\SystemTime getSystemTime() + +Get server current time + +### Example + +```php +getSystemTime(); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SpotApi->getSystemTime: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\GateApi\Model\SystemTime**](../Model/SystemTime.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## countdownCancelAllSpot + +> \GateApi\Model\TriggerTime countdownCancelAllSpot($countdown_cancel_all_spot_task) + +Countdown cancel orders + +When the timeout set by the user is reached, if there is no cancel or set a new countdown, the related pending orders will be automatically cancelled. This endpoint can be called repeatedly to set a new countdown or cancel the countdown. For example, call this endpoint at 30s intervals, each countdown`timeout` is set to 30s. If this endpoint is not called again within 30 seconds, all pending orders on the specified `market` will be automatically cancelled, if no `market` is specified, all market pending orders will be cancelled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will expire and the cacnel function will be cancelled. + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SpotApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$countdown_cancel_all_spot_task = new \GateApi\Model\CountdownCancelAllSpotTask(); // \GateApi\Model\CountdownCancelAllSpotTask | + +try { + $result = $apiInstance->countdownCancelAllSpot($countdown_cancel_all_spot_task); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SpotApi->countdownCancelAllSpot: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **countdown_cancel_all_spot_task** | [**\GateApi\Model\CountdownCancelAllSpotTask**](../Model/CountdownCancelAllSpotTask.md)| | + +### Return type + +[**\GateApi\Model\TriggerTime**](../Model/TriggerTime.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listSpotPriceTriggeredOrders > \GateApi\Model\SpotPriceTriggeredOrder[] listSpotPriceTriggeredOrders($status, $market, $account, $limit, $offset) @@ -1248,10 +1579,10 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$associate_array['status'] = 'status_example'; // string | List orders based on status +$associate_array['status'] = 'status_example'; // string | Only list the orders with this status $associate_array['market'] = 'BTC_USDT'; // string | Currency pair -$associate_array['account'] = 'account_example'; // string | Trading account -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['account'] = 'account_example'; // string | Trading account type. Portfolio margin account must set to `cross_margin` +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 try { @@ -1272,10 +1603,10 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | **string**| List orders based on status | + **status** | **string**| Only list the orders with this status | **market** | **string**| Currency pair | [optional] - **account** | **string**| Trading account | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **account** | **string**| Trading account type. Portfolio margin account must set to `cross_margin` | [optional] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -1379,7 +1710,7 @@ $apiInstance = new GateApi\Api\SpotApi( $config ); $market = 'BTC_USDT'; // string | Currency pair -$account = 'account_example'; // string | Trading account +$account = 'account_example'; // string | Trading account type. Portfolio margin account must set to `cross_margin` try { $result = $apiInstance->cancelSpotPriceTriggeredOrderList($market, $account); @@ -1398,7 +1729,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **market** | **string**| Currency pair | [optional] - **account** | **string**| Trading account | [optional] + **account** | **string**| Trading account type. Portfolio margin account must set to `cross_margin` | [optional] ### Return type @@ -1422,7 +1753,7 @@ Name | Type | Description | Notes > \GateApi\Model\SpotPriceTriggeredOrder getSpotPriceTriggeredOrder($order_id) -Get a single order +Get a price-triggered order ### Example @@ -1440,7 +1771,7 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$order_id = 'order_id_example'; // string | ID returned on order successfully being created +$order_id = 'order_id_example'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->getSpotPriceTriggeredOrder($order_id); @@ -1458,7 +1789,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type @@ -1482,7 +1813,7 @@ Name | Type | Description | Notes > \GateApi\Model\SpotPriceTriggeredOrder cancelSpotPriceTriggeredOrder($order_id) -Cancel a single order +cancel a price-triggered order ### Example @@ -1500,7 +1831,7 @@ $apiInstance = new GateApi\Api\SpotApi( new GuzzleHttp\Client(), $config ); -$order_id = 'order_id_example'; // string | ID returned on order successfully being created +$order_id = 'order_id_example'; // string | Retrieve the data of the order with the specified ID try { $result = $apiInstance->cancelSpotPriceTriggeredOrder($order_id); @@ -1518,7 +1849,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| ID returned on order successfully being created | + **order_id** | **string**| Retrieve the data of the order with the specified ID | ### Return type diff --git a/docs/Api/SubAccountApi.md b/docs/Api/SubAccountApi.md new file mode 100644 index 0000000..3633599 --- /dev/null +++ b/docs/Api/SubAccountApi.md @@ -0,0 +1,619 @@ +# GateApi\SubAccountApi + +All URIs are relative to *https://api.gateio.ws/api/v4* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**listSubAccounts**](SubAccountApi.md#listSubAccounts) | **GET** /sub_accounts | List sub-accounts +[**createSubAccounts**](SubAccountApi.md#createSubAccounts) | **POST** /sub_accounts | Create a new sub-account +[**getSubAccount**](SubAccountApi.md#getSubAccount) | **GET** /sub_accounts/{user_id} | Get the sub-account +[**listSubAccountKeys**](SubAccountApi.md#listSubAccountKeys) | **GET** /sub_accounts/{user_id}/keys | List all API Key of the sub-account +[**createSubAccountKeys**](SubAccountApi.md#createSubAccountKeys) | **POST** /sub_accounts/{user_id}/keys | Create API Key of the sub-account +[**getSubAccountKey**](SubAccountApi.md#getSubAccountKey) | **GET** /sub_accounts/{user_id}/keys/{key} | Get the API Key of the sub-account +[**updateSubAccountKeys**](SubAccountApi.md#updateSubAccountKeys) | **PUT** /sub_accounts/{user_id}/keys/{key} | Update API key of the sub-account +[**deleteSubAccountKeys**](SubAccountApi.md#deleteSubAccountKeys) | **DELETE** /sub_accounts/{user_id}/keys/{key} | Delete API key of the sub-account +[**lockSubAccount**](SubAccountApi.md#lockSubAccount) | **POST** /sub_accounts/{user_id}/lock | Lock the sub-account +[**unlockSubAccount**](SubAccountApi.md#unlockSubAccount) | **POST** /sub_accounts/{user_id}/unlock | Unlock the sub-account + + +## listSubAccounts + +> \GateApi\Model\SubAccount[] listSubAccounts() + +List sub-accounts + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->listSubAccounts(); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->listSubAccounts: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\GateApi\Model\SubAccount[]**](../Model/SubAccount.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## createSubAccounts + +> \GateApi\Model\SubAccount createSubAccounts($sub_account) + +Create a new sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sub_account = new \GateApi\Model\SubAccount(); // \GateApi\Model\SubAccount | + +try { + $result = $apiInstance->createSubAccounts($sub_account); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->createSubAccounts: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sub_account** | [**\GateApi\Model\SubAccount**](../Model/SubAccount.md)| | + +### Return type + +[**\GateApi\Model\SubAccount**](../Model/SubAccount.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getSubAccount + +> \GateApi\Model\SubAccount getSubAccount($user_id) + +Get the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | Sub-account user id + +try { + $result = $apiInstance->getSubAccount($user_id); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->getSubAccount: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| Sub-account user id | + +### Return type + +[**\GateApi\Model\SubAccount**](../Model/SubAccount.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listSubAccountKeys + +> \GateApi\Model\SubAccountKey[] listSubAccountKeys($user_id) + +List all API Key of the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | Sub-account user id + +try { + $result = $apiInstance->listSubAccountKeys($user_id); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->listSubAccountKeys: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| Sub-account user id | + +### Return type + +[**\GateApi\Model\SubAccountKey[]**](../Model/SubAccountKey.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## createSubAccountKeys + +> \GateApi\Model\SubAccountKey[] createSubAccountKeys($user_id, $sub_account_key) + +Create API Key of the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | Sub-account user id +$sub_account_key = new \GateApi\Model\SubAccountKey(); // \GateApi\Model\SubAccountKey | + +try { + $result = $apiInstance->createSubAccountKeys($user_id, $sub_account_key); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->createSubAccountKeys: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| Sub-account user id | + **sub_account_key** | [**\GateApi\Model\SubAccountKey**](../Model/SubAccountKey.md)| | + +### Return type + +[**\GateApi\Model\SubAccountKey[]**](../Model/SubAccountKey.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## getSubAccountKey + +> \GateApi\Model\SubAccountKey getSubAccountKey($user_id, $key) + +Get the API Key of the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | Sub-account user id +$key = 'key_example'; // string | The API Key of the sub-account + +try { + $result = $apiInstance->getSubAccountKey($user_id, $key); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->getSubAccountKey: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| Sub-account user id | + **key** | **string**| The API Key of the sub-account | + +### Return type + +[**\GateApi\Model\SubAccountKey**](../Model/SubAccountKey.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## updateSubAccountKeys + +> updateSubAccountKeys($user_id, $key, $sub_account_key) + +Update API key of the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | Sub-account user id +$key = 'key_example'; // string | The API Key of the sub-account +$sub_account_key = new \GateApi\Model\SubAccountKey(); // \GateApi\Model\SubAccountKey | + +try { + $apiInstance->updateSubAccountKeys($user_id, $key, $sub_account_key); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->updateSubAccountKeys: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| Sub-account user id | + **key** | **string**| The API Key of the sub-account | + **sub_account_key** | [**\GateApi\Model\SubAccountKey**](../Model/SubAccountKey.md)| | + +### Return type + +void (empty response body) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## deleteSubAccountKeys + +> deleteSubAccountKeys($user_id, $key) + +Delete API key of the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | Sub-account user id +$key = 'key_example'; // string | The API Key of the sub-account + +try { + $apiInstance->deleteSubAccountKeys($user_id, $key); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->deleteSubAccountKeys: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| Sub-account user id | + **key** | **string**| The API Key of the sub-account | + +### Return type + +void (empty response body) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## lockSubAccount + +> lockSubAccount($user_id) + +Lock the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | The user id of the sub-account + +try { + $apiInstance->lockSubAccount($user_id); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->lockSubAccount: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| The user id of the sub-account | + +### Return type + +void (empty response body) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## unlockSubAccount + +> unlockSubAccount($user_id) + +Unlock the sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\SubAccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$user_id = 56; // int | The user id of the sub-account + +try { + $apiInstance->unlockSubAccount($user_id); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling SubAccountApi->unlockSubAccount: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_id** | **int**| The user id of the sub-account | + +### Return type + +void (empty response body) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Api/WalletApi.md b/docs/Api/WalletApi.md index cfa2ab8..dd9a8c1 100644 --- a/docs/Api/WalletApi.md +++ b/docs/Api/WalletApi.md @@ -4,15 +4,78 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- +[**listCurrencyChains**](WalletApi.md#listCurrencyChains) | **GET** /wallet/currency_chains | List chains supported for specified currency [**getDepositAddress**](WalletApi.md#getDepositAddress) | **GET** /wallet/deposit_address | Generate currency deposit address [**listWithdrawals**](WalletApi.md#listWithdrawals) | **GET** /wallet/withdrawals | Retrieve withdrawal records [**listDeposits**](WalletApi.md#listDeposits) | **GET** /wallet/deposits | Retrieve deposit records [**transfer**](WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between trading accounts -[**listSubAccountTransfers**](WalletApi.md#listSubAccountTransfers) | **GET** /wallet/sub_account_transfers | Transfer records between main and sub accounts +[**listSubAccountTransfers**](WalletApi.md#listSubAccountTransfers) | **GET** /wallet/sub_account_transfers | Retrieve transfer records between main and sub accounts [**transferWithSubAccount**](WalletApi.md#transferWithSubAccount) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts +[**subAccountToSubAccount**](WalletApi.md#subAccountToSubAccount) | **POST** /wallet/sub_account_to_sub_account | Sub-account transfers to sub-account [**listWithdrawStatus**](WalletApi.md#listWithdrawStatus) | **GET** /wallet/withdraw_status | Retrieve withdrawal status [**listSubAccountBalances**](WalletApi.md#listSubAccountBalances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances +[**listSubAccountMarginBalances**](WalletApi.md#listSubAccountMarginBalances) | **GET** /wallet/sub_account_margin_balances | Query sub accounts' margin balances +[**listSubAccountFuturesBalances**](WalletApi.md#listSubAccountFuturesBalances) | **GET** /wallet/sub_account_futures_balances | Query sub accounts' futures account balances +[**listSubAccountCrossMarginBalances**](WalletApi.md#listSubAccountCrossMarginBalances) | **GET** /wallet/sub_account_cross_margin_balances | Query subaccount's cross_margin account info +[**listSavedAddress**](WalletApi.md#listSavedAddress) | **GET** /wallet/saved_address | Query saved address [**getTradeFee**](WalletApi.md#getTradeFee) | **GET** /wallet/fee | Retrieve personal trading fee +[**getTotalBalance**](WalletApi.md#getTotalBalance) | **GET** /wallet/total_balance | Retrieve user's total balances + + +## listCurrencyChains + +> \GateApi\Model\CurrencyChain[] listCurrencyChains($currency) + +List chains supported for specified currency + +### Example + +```php +listCurrencyChains($currency); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->listCurrencyChains: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Currency name | + +### Return type + +[**\GateApi\Model\CurrencyChain[]**](../Model/CurrencyChain.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) ## getDepositAddress @@ -102,7 +165,7 @@ $apiInstance = new GateApi\Api\WalletApi( $associate_array['currency'] = 'BTC'; // string | Filter by currency. Return all currency records if not specified $associate_array['from'] = 1602120000; // int | Time range beginning, default to 7 days before current time $associate_array['to'] = 1602123600; // int | Time range ending, default to current time -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 try { @@ -126,7 +189,7 @@ Name | Type | Description | Notes **currency** | **string**| Filter by currency. Return all currency records if not specified | [optional] **from** | **int**| Time range beginning, default to 7 days before current time | [optional] **to** | **int**| Time range ending, default to current time | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -174,7 +237,7 @@ $apiInstance = new GateApi\Api\WalletApi( $associate_array['currency'] = 'BTC'; // string | Filter by currency. Return all currency records if not specified $associate_array['from'] = 1602120000; // int | Time range beginning, default to 7 days before current time $associate_array['to'] = 1602123600; // int | Time range ending, default to current time -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 try { @@ -198,7 +261,7 @@ Name | Type | Description | Notes **currency** | **string**| Filter by currency. Return all currency records if not specified | [optional] **from** | **int**| Time range beginning, default to 7 days before current time | [optional] **to** | **int**| Time range ending, default to current time | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -221,11 +284,11 @@ Name | Type | Description | Notes ## transfer -> transfer($transfer) +> \GateApi\Model\TransactionID transfer($transfer) Transfer between trading accounts -Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery 4. spot - cross margin +Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery 4. spot - cross margin 5. spot - options ### Example @@ -246,7 +309,8 @@ $apiInstance = new GateApi\Api\WalletApi( $transfer = new \GateApi\Model\Transfer(); // \GateApi\Model\Transfer | try { - $apiInstance->transfer($transfer); + $result = $apiInstance->transfer($transfer); + print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { @@ -264,7 +328,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**\GateApi\Model\TransactionID**](../Model/TransactionID.md) ### Authorization @@ -273,7 +337,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json -- **Accept**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) @@ -284,7 +348,7 @@ void (empty response body) > \GateApi\Model\SubAccountTransfer[] listSubAccountTransfers($sub_uid, $from, $to, $limit, $offset) -Transfer records between main and sub accounts +Retrieve transfer records between main and sub accounts Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved @@ -304,10 +368,10 @@ $apiInstance = new GateApi\Api\WalletApi( new GuzzleHttp\Client(), $config ); -$associate_array['sub_uid'] = '10003'; // string | Sub account user ID. Return records related to all sub accounts if not specified +$associate_array['sub_uid'] = '10003'; // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts $associate_array['from'] = 1602120000; // int | Time range beginning, default to 7 days before current time $associate_array['to'] = 1602123600; // int | Time range ending, default to current time -$associate_array['limit'] = 100; // int | Maximum number of records returned in one list +$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list $associate_array['offset'] = 0; // int | List offset, starting from 0 try { @@ -328,10 +392,10 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **sub_uid** | **string**| Sub account user ID. Return records related to all sub accounts if not specified | [optional] + **sub_uid** | **string**| User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] **from** | **int**| Time range beginning, default to 7 days before current time | [optional] **to** | **int**| Time range ending, default to current time | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type @@ -413,6 +477,65 @@ void (empty response body) [[Back to README]](../../README.md) +## subAccountToSubAccount + +> subAccountToSubAccount($sub_account_to_sub_account) + +Sub-account transfers to sub-account + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\WalletApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$sub_account_to_sub_account = new \GateApi\Model\SubAccountToSubAccount(); // \GateApi\Model\SubAccountToSubAccount | + +try { + $apiInstance->subAccountToSubAccount($sub_account_to_sub_account); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->subAccountToSubAccount: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sub_account_to_sub_account** | [**\GateApi\Model\SubAccountToSubAccount**](../Model/SubAccountToSubAccount.md)| | + +### Return type + +void (empty response body) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## listWithdrawStatus > \GateApi\Model\WithdrawStatus[] listWithdrawStatus($currency) @@ -435,7 +558,7 @@ $apiInstance = new GateApi\Api\WalletApi( new GuzzleHttp\Client(), $config ); -$associate_array['currency'] = 'BTC'; // string | Retrieved specified currency related data +$associate_array['currency'] = 'BTC'; // string | Retrieve data of the specified currency try { $result = $apiInstance->listWithdrawStatus($associate_array); @@ -455,7 +578,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **string**| Retrieved specified currency related data | [optional] + **currency** | **string**| Retrieve data of the specified currency | [optional] ### Return type @@ -497,7 +620,7 @@ $apiInstance = new GateApi\Api\WalletApi( new GuzzleHttp\Client(), $config ); -$associate_array['sub_uid'] = '10003'; // string | Sub account user ID. Return records related to all sub accounts if not specified +$associate_array['sub_uid'] = '10003'; // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts try { $result = $apiInstance->listSubAccountBalances($associate_array); @@ -517,7 +640,7 @@ Note: the input parameter is an associative array with the keys listed as the pa Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **sub_uid** | **string**| Sub account user ID. Return records related to all sub accounts if not specified | [optional] + **sub_uid** | **string**| User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] ### Return type @@ -537,9 +660,263 @@ Name | Type | Description | Notes [[Back to README]](../../README.md) +## listSubAccountMarginBalances + +> \GateApi\Model\SubAccountMarginBalance[] listSubAccountMarginBalances($sub_uid) + +Query sub accounts' margin balances + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\WalletApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['sub_uid'] = '10003'; // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts + +try { + $result = $apiInstance->listSubAccountMarginBalances($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->listSubAccountMarginBalances: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sub_uid** | **string**| User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] + +### Return type + +[**\GateApi\Model\SubAccountMarginBalance[]**](../Model/SubAccountMarginBalance.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listSubAccountFuturesBalances + +> \GateApi\Model\SubAccountFuturesBalance[] listSubAccountFuturesBalances($sub_uid, $settle) + +Query sub accounts' futures account balances + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\WalletApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['sub_uid'] = '10003'; // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts +$associate_array['settle'] = 'usdt'; // string | Query only balances of specified settle currency + +try { + $result = $apiInstance->listSubAccountFuturesBalances($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->listSubAccountFuturesBalances: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sub_uid** | **string**| User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] + **settle** | **string**| Query only balances of specified settle currency | [optional] + +### Return type + +[**\GateApi\Model\SubAccountFuturesBalance[]**](../Model/SubAccountFuturesBalance.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listSubAccountCrossMarginBalances + +> \GateApi\Model\SubAccountCrossMarginBalance[] listSubAccountCrossMarginBalances($sub_uid) + +Query subaccount's cross_margin account info + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\WalletApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['sub_uid'] = '10003'; // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts + +try { + $result = $apiInstance->listSubAccountCrossMarginBalances($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->listSubAccountCrossMarginBalances: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sub_uid** | **string**| User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] + +### Return type + +[**\GateApi\Model\SubAccountCrossMarginBalance[]**](../Model/SubAccountCrossMarginBalance.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## listSavedAddress + +> \GateApi\Model\SavedAddress[] listSavedAddress($currency, $chain, $limit) + +Query saved address + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\WalletApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency'] = 'USDT'; // string | Currency +$associate_array['chain'] = ''; // string | Chain name +$associate_array['limit'] = '50'; // string | Maximum number returned, 100 at most + +try { + $result = $apiInstance->listSavedAddress($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->listSavedAddress: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Currency | + **chain** | **string**| Chain name | [optional] [default to ''] + **limit** | **string**| Maximum number returned, 100 at most | [optional] [default to '50'] + +### Return type + +[**\GateApi\Model\SavedAddress[]**](../Model/SavedAddress.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + ## getTradeFee -> \GateApi\Model\TradeFee getTradeFee() +> \GateApi\Model\TradeFee getTradeFee($currency_pair, $settle) Retrieve personal trading fee @@ -559,9 +936,11 @@ $apiInstance = new GateApi\Api\WalletApi( new GuzzleHttp\Client(), $config ); +$associate_array['currency_pair'] = 'BTC_USDT'; // string | Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs +$associate_array['settle'] = 'BTC'; // string | Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. try { - $result = $apiInstance->getTradeFee(); + $result = $apiInstance->getTradeFee($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; @@ -573,7 +952,13 @@ try { ### Parameters -This endpoint does not need any parameter. +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency_pair** | **string**| Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs | [optional] + **settle** | **string**| Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. | [optional] ### Return type @@ -592,3 +977,67 @@ This endpoint does not need any parameter. [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +## getTotalBalance + +> \GateApi\Model\TotalBalance getTotalBalance($currency) + +Retrieve user's total balances + +This endpoint returns an approximate sum of exchanged amount from all currencies to input currency for each account.The exchange rate and account balance could have been cached for at most 1 minute. It is not recommended to use its result for any trading calculation. For trading calculation, use the corresponding account query endpoint for each account type. For example: - `GET /spot/accounts` to query spot account balance - `GET /margin/accounts` to query margin account balance - `GET /futures/{settle}/accounts` to query futures account balance + +### Example + +```php +setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); + + +$apiInstance = new GateApi\Api\WalletApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$associate_array['currency'] = 'USDT'; // string | Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. + +try { + $result = $apiInstance->getTotalBalance($associate_array); + print_r($result); +} catch (GateApi\GateApiException $e) { + echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; +} catch (Exception $e) { + echo 'Exception when calling WalletApi->getTotalBalance: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Note: the input parameter is an associative array with the keys listed as the parameter name below. + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **string**| Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. | [optional] [default to 'USDT'] + +### Return type + +[**\GateApi\Model\TotalBalance**](../Model/TotalBalance.md) + +### Authorization + +[apiv4](../../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Model/AccountBalance.md b/docs/Model/AccountBalance.md new file mode 100644 index 0000000..c541549 --- /dev/null +++ b/docs/Model/AccountBalance.md @@ -0,0 +1,10 @@ +# # AccountBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **string** | Account total balance amount | [optional] +**currency** | **string** | Currency | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AgencyCommission.md b/docs/Model/AgencyCommission.md new file mode 100644 index 0000000..d3f9b81 --- /dev/null +++ b/docs/Model/AgencyCommission.md @@ -0,0 +1,14 @@ +# # AgencyCommission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**commission_time** | **int** | Commission Time. (unix timestamp) | [optional] +**user_id** | **int** | User ID | [optional] +**group_name** | **string** | Group name | [optional] +**commission_amount** | **string** | Commission Amount | [optional] +**commission_asset** | **string** | Commission Asset | [optional] +**source** | **string** | Source. SPOT - SPOT Rebate, FUTURES - Futures Rebate | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AgencyCommissionHistory.md b/docs/Model/AgencyCommissionHistory.md new file mode 100644 index 0000000..7490723 --- /dev/null +++ b/docs/Model/AgencyCommissionHistory.md @@ -0,0 +1,11 @@ +# # AgencyCommissionHistory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency_pair** | **string** | Currency pair | [optional] +**total** | **int** | Total | [optional] +**list** | [**\GateApi\Model\AgencyCommission[]**](AgencyCommission.md) | List of comission history | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AgencyTransaction.md b/docs/Model/AgencyTransaction.md new file mode 100644 index 0000000..b653bcc --- /dev/null +++ b/docs/Model/AgencyTransaction.md @@ -0,0 +1,17 @@ +# # AgencyTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**transaction_time** | **int** | Transaction Time. (unix timestamp) | [optional] +**user_id** | **int** | User ID | [optional] +**group_name** | **string** | Group name | [optional] +**fee** | **string** | Fee | [optional] +**fee_asset** | **string** | Fee currency | [optional] +**currency_pair** | **string** | Currency pair | [optional] +**amount** | **string** | Commission Amount | [optional] +**amount_asset** | **string** | Commission Asset | [optional] +**source** | **string** | Source. SPOT - SPOT Rebate, FUTURES - Futures Rebate | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AgencyTransactionHistory.md b/docs/Model/AgencyTransactionHistory.md new file mode 100644 index 0000000..e332f9e --- /dev/null +++ b/docs/Model/AgencyTransactionHistory.md @@ -0,0 +1,11 @@ +# # AgencyTransactionHistory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency_pair** | **string** | Currency pair | [optional] +**total** | **int** | Total | [optional] +**list** | [**\GateApi\Model\AgencyTransaction[]**](AgencyTransaction.md) | List of transaction history | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ApiV4KeyPerm.md b/docs/Model/ApiV4KeyPerm.md new file mode 100644 index 0000000..b9f3dc6 --- /dev/null +++ b/docs/Model/ApiV4KeyPerm.md @@ -0,0 +1,10 @@ +# # ApiV4KeyPerm + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Permission name (all permissions will be removed if no value is passed) - wallet: wallet - spot: spot/margin - futures: perpetual contract - delivery: delivery - earn: earn - options: options | [optional] +**read_only** | **bool** | read only | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BatchFuturesOrder.md b/docs/Model/BatchFuturesOrder.md new file mode 100644 index 0000000..cf2f153 --- /dev/null +++ b/docs/Model/BatchFuturesOrder.md @@ -0,0 +1,34 @@ +# # BatchFuturesOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**succeeded** | **bool** | Whether the batch of orders succeeded | [optional] +**label** | **string** | Error label, only exists if execution fails | [optional] +**detail** | **string** | Error detail, only present if execution failed and details need to be given | [optional] +**id** | **int** | Futures order ID | [optional] [readonly] +**user** | **int** | User ID | [optional] [readonly] +**create_time** | **double** | Creation time of order | [optional] [readonly] +**finish_time** | **double** | Order finished time. Not returned if order is open | [optional] [readonly] +**finish_as** | **string** | How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close | [optional] [readonly] +**status** | **string** | Order status - `open`: waiting to be traded - `finished`: finished | [optional] [readonly] +**contract** | **string** | Futures contract | [optional] +**size** | **int** | Order size. Specify positive number to make a bid, and negative number to ask | [optional] +**iceberg** | **int** | Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size | [optional] +**price** | **string** | Order price. 0 for market order with `tif` set as `ioc` | [optional] +**close** | **bool** | Set as `true` to close the position, with `size` set to 0 | [optional] [default to false] +**is_close** | **bool** | Is the order to close position | [optional] [readonly] +**reduce_only** | **bool** | Set as `true` to be reduce-only order | [optional] [default to false] +**is_reduce_only** | **bool** | Is the order reduce-only | [optional] [readonly] +**is_liq** | **bool** | Is the order for liquidation | [optional] [readonly] +**tif** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none | [optional] [default to 'gtc'] +**left** | **int** | Size left to be traded | [optional] [readonly] +**fill_price** | **string** | Fill price of the order | [optional] [readonly] +**text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance | [optional] +**tkfr** | **string** | Taker fee | [optional] [readonly] +**mkfr** | **string** | Maker fee | [optional] [readonly] +**refu** | **int** | Reference user ID | [optional] [readonly] +**auto_size** | **string** | Set side to close dual-mode position. `close_long` closes the long side; while `close_short` the short one. Note `size` also needs to be set to 0 | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BatchOrder.md b/docs/Model/BatchOrder.md index fa4e4b3..f39d1f2 100644 --- a/docs/Model/BatchOrder.md +++ b/docs/Model/BatchOrder.md @@ -5,23 +5,23 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) | [optional] -**succeeded** | **bool** | Whether order succeeds | [optional] -**label** | **string** | Error label, empty string if order succeeds | [optional] -**message** | **string** | Detailed error message, empty string if order succeeds | [optional] +**succeeded** | **bool** | Whether the batch of orders succeeded | [optional] +**label** | **string** | Error label, if any, otherwise an empty string | [optional] +**message** | **string** | Detailed error message, if any, otherwise an empty string | [optional] **id** | **string** | Order ID | [optional] [readonly] -**create_time** | **string** | Order creation time | [optional] [readonly] -**update_time** | **string** | Order last modification time | [optional] [readonly] -**create_time_ms** | **int** | Order creation time in milliseconds | [optional] [readonly] -**update_time_ms** | **int** | Order last modification time in milliseconds | [optional] [readonly] +**create_time** | **string** | Creation time of order | [optional] [readonly] +**update_time** | **string** | Last modification time of order | [optional] [readonly] +**create_time_ms** | **int** | Creation time of order (in milliseconds) | [optional] [readonly] +**update_time_ms** | **int** | Last modification time of order (in milliseconds) | [optional] [readonly] **status** | **string** | Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled | [optional] [readonly] **currency_pair** | **string** | Currency pair | [optional] -**type** | **string** | Order type. limit - limit order | [optional] [default to 'limit'] +**type** | **string** | Order Type - limit : Limit Order - market : Market Order | [optional] [default to 'limit'] **account** | **string** | Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account | [optional] [default to 'spot'] **side** | **string** | Order side | [optional] **amount** | **string** | Trade amount | [optional] **price** | **string** | Order price | [optional] -**time_in_force** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee | [optional] [default to 'gtc'] -**iceberg** | **string** | Amount to display for the iceberg order. Null or 0 for normal orders. Set to -1 to hide the amount totally | [optional] +**time_in_force** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none | [optional] [default to 'gtc'] +**iceberg** | **string** | Amount to display for the iceberg order. Null or 0 for normal orders. Hiding all amount is not supported. | [optional] **auto_borrow** | **bool** | Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. | [optional] **auto_repay** | **bool** | Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. | [optional] **left** | **string** | Amount left to fill | [optional] [readonly] @@ -29,7 +29,7 @@ Name | Type | Description | Notes **filled_total** | **string** | Total filled in quote currency | [optional] [readonly] **fee** | **string** | Fee deducted | [optional] [readonly] **fee_currency** | **string** | Fee currency unit | [optional] [readonly] -**point_fee** | **string** | Point used to deduct fee | [optional] [readonly] +**point_fee** | **string** | Points used to deduct fee | [optional] [readonly] **gt_fee** | **string** | GT used to deduct fee | [optional] [readonly] **gt_discount** | **bool** | Whether GT fee discount is used | [optional] [readonly] **rebated_fee** | **string** | Rebated fee | [optional] [readonly] diff --git a/docs/Model/CancelOrder.md b/docs/Model/CancelOrder.md index c2c88c6..7c878ea 100644 --- a/docs/Model/CancelOrder.md +++ b/docs/Model/CancelOrder.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency_pair** | **string** | Order currency pair | **id** | **string** | Order ID or user custom ID. Custom ID are accepted only within 30 minutes after order creation | -**account** | **string** | If cancelled order is cross margin order, this field must be set and can only be `cross_margin` | [optional] +**account** | **string** | If cancelled order is cross margin order or is portfolio margin account's API key, this field must be set and can only be `cross_margin`If cancelled order is cross margin order, this field must be set and can only be `cross_margin` | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Contract.md b/docs/Model/Contract.md index 44e9e0e..260e25f 100644 --- a/docs/Model/Contract.md +++ b/docs/Model/Contract.md @@ -31,10 +31,12 @@ Name | Type | Description | Notes **ref_rebate_rate** | **string** | Referrer commission rate | [optional] **orderbook_id** | **int** | Current orderbook ID | [optional] **trade_id** | **int** | Current trade ID | [optional] -**trade_size** | **int** | Historical accumulation trade size | [optional] +**trade_size** | **int** | Historical accumulated trade size | [optional] **position_size** | **int** | Current total long position size | [optional] -**config_change_time** | **double** | Configuration's last changed time | [optional] +**config_change_time** | **double** | Last changed time of configuration | [optional] **in_delisting** | **bool** | Contract is delisting | [optional] **orders_limit** | **int** | Maximum number of open orders | [optional] +**enable_bonus** | **bool** | Whether bouns is enabled | [optional] +**enable_credit** | **bool** | Whether portfolio margin account is enabled | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CountdownCancelAllFuturesTask.md b/docs/Model/CountdownCancelAllFuturesTask.md new file mode 100644 index 0000000..7bbb0cd --- /dev/null +++ b/docs/Model/CountdownCancelAllFuturesTask.md @@ -0,0 +1,10 @@ +# # CountdownCancelAllFuturesTask + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timeout** | **int** | Countdown time, in seconds At least 5 seconds, 0 means cancel the countdown | +**contract** | **string** | Futures contract | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CountdownCancelAllSpotTask.md b/docs/Model/CountdownCancelAllSpotTask.md new file mode 100644 index 0000000..bb07ac2 --- /dev/null +++ b/docs/Model/CountdownCancelAllSpotTask.md @@ -0,0 +1,10 @@ +# # CountdownCancelAllSpotTask + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timeout** | **int** | Countdown time, in seconds At least 5 seconds, 0 means cancel the countdown | +**currency_pair** | **string** | Currency pair | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginAccount.md b/docs/Model/CrossMarginAccount.md index 8f57db4..a76f4cb 100644 --- a/docs/Model/CrossMarginAccount.md +++ b/docs/Model/CrossMarginAccount.md @@ -11,5 +11,12 @@ Name | Type | Description | Notes **borrowed** | **string** | Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` | [optional] **interest** | **string** | Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` | [optional] **risk** | **string** | Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` | [optional] +**total_initial_margin** | **string** | Total initial margin | [optional] +**total_margin_balance** | **string** | Total margin balance | [optional] +**total_maintenance_margin** | **string** | Total maintenance margin | [optional] +**total_initial_margin_rate** | **string** | Total initial margin rate | [optional] +**total_maintenance_margin_rate** | **string** | Total maintenance margin rate | [optional] +**total_available_margin** | **string** | Total available margin | [optional] +**portfolio_margin_total** | **string** | Total amount of the portfolio margin account | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginAccountBook.md b/docs/Model/CrossMarginAccountBook.md new file mode 100644 index 0000000..291130e --- /dev/null +++ b/docs/Model/CrossMarginAccountBook.md @@ -0,0 +1,14 @@ +# # CrossMarginAccountBook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Balance change record ID | [optional] +**time** | **int** | The timestamp of the change (in milliseconds) | [optional] +**currency** | **string** | Currency changed | [optional] +**change** | **string** | Amount changed. Positive value means transferring in, while negative out | [optional] +**balance** | **string** | Balance after change | [optional] +**type** | **string** | Account change type, including: - in: transferals into cross margin account - out: transferals out from cross margin account - repay: loan repayment - borrow: borrowed loan - interest: interest - new_order: new order locked - order_fill: order fills - referral_fee: fee refund from referrals - order_fee: order fee generated from fills - unknown: unknown type | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginBalance.md b/docs/Model/CrossMarginBalance.md index 108f2d8..356c542 100644 --- a/docs/Model/CrossMarginBalance.md +++ b/docs/Model/CrossMarginBalance.md @@ -7,6 +7,6 @@ Name | Type | Description | Notes **available** | **string** | Available amount | [optional] **freeze** | **string** | Locked amount | [optional] **borrowed** | **string** | Borrowed amount | [optional] -**interest** | **string** | Interests unpaid | [optional] +**interest** | **string** | Unpaid interests | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginBorrowable.md b/docs/Model/CrossMarginBorrowable.md new file mode 100644 index 0000000..ffd77b3 --- /dev/null +++ b/docs/Model/CrossMarginBorrowable.md @@ -0,0 +1,10 @@ +# # CrossMarginBorrowable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency detail | [optional] +**amount** | **string** | Max borrowable amount | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginCurrency.md b/docs/Model/CrossMarginCurrency.md index 222b353..2d62162 100644 --- a/docs/Model/CrossMarginCurrency.md +++ b/docs/Model/CrossMarginCurrency.md @@ -5,12 +5,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | Currency name | [optional] -**rate** | **string** | Loan rate | [optional] +**rate** | **string** | Minimum lending rate (hourly rate) | [optional] **prec** | **string** | Currency precision | [optional] **discount** | **string** | Currency value discount, which is used in total value calculation | [optional] **min_borrow_amount** | **string** | Minimum currency borrow amount. Unit is currency itself | [optional] **user_max_borrow_amount** | **string** | Maximum borrow value allowed per user, in USDT | [optional] **total_max_borrow_amount** | **string** | Maximum borrow value allowed for this currency, in USDT | [optional] **price** | **string** | Price change between this currency and USDT | [optional] +**status** | **int** | status - `0` : disable - `1` : enable | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginLoan.md b/docs/Model/CrossMarginLoan.md index 95cc454..3bf6b80 100644 --- a/docs/Model/CrossMarginLoan.md +++ b/docs/Model/CrossMarginLoan.md @@ -13,6 +13,6 @@ Name | Type | Description | Notes **status** | **int** | Borrow loan status, which includes: - 1: failed to borrow - 2: borrowed but not repaid - 3: repayment complete | [optional] [readonly] **repaid** | **string** | Repaid amount | [optional] [readonly] **repaid_interest** | **string** | Repaid interest | [optional] [readonly] -**unpaid_interest** | **string** | Interest not repaid | [optional] [readonly] +**unpaid_interest** | **string** | Outstanding interest yet to be paid | [optional] [readonly] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CrossMarginTransferable.md b/docs/Model/CrossMarginTransferable.md new file mode 100644 index 0000000..1bdf40b --- /dev/null +++ b/docs/Model/CrossMarginTransferable.md @@ -0,0 +1,10 @@ +# # CrossMarginTransferable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency detail | [optional] +**amount** | **string** | Max transferable amount | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Currency.md b/docs/Model/Currency.md index d34990d..5162e2c 100644 --- a/docs/Model/Currency.md +++ b/docs/Model/Currency.md @@ -10,5 +10,7 @@ Name | Type | Description | Notes **withdraw_delayed** | **bool** | Whether currency's withdrawal is delayed | [optional] **deposit_disabled** | **bool** | Whether currency's deposit is disabled | [optional] **trade_disabled** | **bool** | Whether currency's trading is disabled | [optional] +**fixed_rate** | **string** | Fixed fee rate. Only for fixed rate currencies, not valid for normal currencies | [optional] +**chain** | **string** | Chain of currency | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CurrencyChain.md b/docs/Model/CurrencyChain.md new file mode 100644 index 0000000..a84ddfe --- /dev/null +++ b/docs/Model/CurrencyChain.md @@ -0,0 +1,14 @@ +# # CurrencyChain + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain** | **string** | Chain name | [optional] +**name_cn** | **string** | Chain name in Chinese | [optional] +**name_en** | **string** | Chain name in English | [optional] +**is_disabled** | **int** | If it is disabled. 0 means NOT being disabled | [optional] +**is_deposit_disabled** | **int** | Is deposit disabled. 0 means not | [optional] +**is_withdraw_disabled** | **int** | Is withdrawal disabled. 0 means not | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeliveryContract.md b/docs/Model/DeliveryContract.md index 95ca7d1..09c38f4 100644 --- a/docs/Model/DeliveryContract.md +++ b/docs/Model/DeliveryContract.md @@ -37,9 +37,9 @@ Name | Type | Description | Notes **ref_rebate_rate** | **string** | Referrer commission rate | [optional] **orderbook_id** | **int** | Current orderbook ID | [optional] **trade_id** | **int** | Current trade ID | [optional] -**trade_size** | **int** | Historical accumulation trade size | [optional] +**trade_size** | **int** | Historical accumulated trade size | [optional] **position_size** | **int** | Current total long position size | [optional] -**config_change_time** | **double** | Configuration's last changed time | [optional] +**config_change_time** | **double** | Last changed time of configuration | [optional] **in_delisting** | **bool** | Contract is delisting | [optional] **orders_limit** | **int** | Maximum number of open orders | [optional] diff --git a/docs/Model/DepositAddress.md b/docs/Model/DepositAddress.md index 5ca10d3..b193c5a 100644 --- a/docs/Model/DepositAddress.md +++ b/docs/Model/DepositAddress.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency** | **string** | Currency detail | **address** | **string** | Deposit address | -**multichain_address** | [**\GateApi\Model\MultiChainAddressItem[]**](MultiChainAddressItem.md) | | [optional] +**multichain_addresses** | [**\GateApi\Model\MultiChainAddressItem[]**](MultiChainAddressItem.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FlashSwapCurrency.md b/docs/Model/FlashSwapCurrency.md new file mode 100644 index 0000000..84ae8ca --- /dev/null +++ b/docs/Model/FlashSwapCurrency.md @@ -0,0 +1,12 @@ +# # FlashSwapCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency name | [optional] [readonly] +**min_amount** | **string** | Minimum amount required in flash swap | [optional] [readonly] +**max_amount** | **string** | Maximum amount allowed in flash swap | [optional] [readonly] +**swappable** | **string[]** | Currencies which can be swapped to from this currency | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FlashSwapOrder.md b/docs/Model/FlashSwapOrder.md new file mode 100644 index 0000000..73cfba6 --- /dev/null +++ b/docs/Model/FlashSwapOrder.md @@ -0,0 +1,17 @@ +# # FlashSwapOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Flash swap order ID | [optional] [readonly] +**create_time** | **int** | Creation time of order (in milliseconds) | [optional] [readonly] +**user_id** | **int** | User ID | [optional] [readonly] +**sell_currency** | **string** | Currency to sell | [optional] [readonly] +**sell_amount** | **string** | Amount to sell | [optional] [readonly] +**buy_currency** | **string** | Currency to buy | [optional] [readonly] +**buy_amount** | **string** | Amount to buy | [optional] [readonly] +**price** | **string** | Price | [optional] [readonly] +**status** | **int** | Flash swap order status `1` - success `2` - failure | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FlashSwapOrderPreview.md b/docs/Model/FlashSwapOrderPreview.md new file mode 100644 index 0000000..c9df7f3 --- /dev/null +++ b/docs/Model/FlashSwapOrderPreview.md @@ -0,0 +1,14 @@ +# # FlashSwapOrderPreview + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**preview_id** | **string** | Preview result ID | [optional] +**sell_currency** | **string** | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | [optional] +**sell_amount** | **string** | Amount to sell | [optional] +**buy_currency** | **string** | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | [optional] +**buy_amount** | **string** | Amount to buy | [optional] +**price** | **string** | Price | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FlashSwapOrderRequest.md b/docs/Model/FlashSwapOrderRequest.md new file mode 100644 index 0000000..8a3b872 --- /dev/null +++ b/docs/Model/FlashSwapOrderRequest.md @@ -0,0 +1,13 @@ +# # FlashSwapOrderRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**preview_id** | **string** | Preview result ID | [optional] +**sell_currency** | **string** | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | +**sell_amount** | **string** | Amount to sell. It is required to choose one parameter between `sell_amount` and `buy_amount` | [optional] +**buy_currency** | **string** | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | +**buy_amount** | **string** | Amount to buy. It is required to choose one parameter between `sell_amount` and `buy_amount` | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FundingAccount.md b/docs/Model/FundingAccount.md index df934cf..5da8687 100644 --- a/docs/Model/FundingAccount.md +++ b/docs/Model/FundingAccount.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **currency** | **string** | Currency name | [optional] **available** | **string** | Available assets to lend, which is identical to spot account `available` | [optional] **locked** | **string** | Locked amount. i.e. amount in `open` loans | [optional] -**lent** | **string** | Amount that is loaned but not repaid | [optional] +**lent** | **string** | Outstanding loan amount yet to be repaid | [optional] **total_lent** | **string** | Amount used for lending. total_lent = lent + locked | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FundingBookItem.md b/docs/Model/FundingBookItem.md index 0c6a76b..2fc1673 100644 --- a/docs/Model/FundingBookItem.md +++ b/docs/Model/FundingBookItem.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**rate** | **string** | Loan rate | [optional] +**rate** | **string** | Loan rate (daily rate) | [optional] **amount** | **string** | Borrowable amount | [optional] -**days** | **int** | How long the loan should be repaid | [optional] +**days** | **int** | The number of days till the loan repayment's dateline | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesAccount.md b/docs/Model/FuturesAccount.md index b630546..3e5daa8 100644 --- a/docs/Model/FuturesAccount.md +++ b/docs/Model/FuturesAccount.md @@ -4,13 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**total** | **string** | Total assets, total = position_margin + order_margin + available | [optional] +**total** | **string** | total is the balance after the user's accumulated deposit, withdraw, profit and loss (including realized profit and loss, fund, fee and referral rebate), excluding unrealized profit and loss. total = SUM(history_dnw, history_pnl, history_fee, history_refr, history_fund) | [optional] **unrealised_pnl** | **string** | Unrealized PNL | [optional] **position_margin** | **string** | Position margin | [optional] **order_margin** | **string** | Order margin of unfinished orders | [optional] -**available** | **string** | Available balance to transfer out or trade | [optional] +**available** | **string** | The available balance for transferring or trading(including bonus. Bonus can't be be withdrawn. The transfer amount needs to deduct the bonus) | [optional] **point** | **string** | POINT amount | [optional] **currency** | **string** | Settle currency | [optional] **in_dual_mode** | **bool** | Whether dual mode is enabled | [optional] +**enable_credit** | **bool** | Whether portfolio margin account mode is enabled | [optional] +**position_initial_margin** | **string** | Initial margin position, applicable to the portfolio margin account model | [optional] +**maintenance_margin** | **string** | Maintenance margin position, applicable to the portfolio margin account model | [optional] +**bonus** | **string** | Perpetual Contract Bonus | [optional] +**history** | [**\GateApi\Model\FuturesAccountHistory**](FuturesAccountHistory.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesAccountHistory.md b/docs/Model/FuturesAccountHistory.md new file mode 100644 index 0000000..290d09e --- /dev/null +++ b/docs/Model/FuturesAccountHistory.md @@ -0,0 +1,18 @@ +# # FuturesAccountHistory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dnw** | **string** | total amount of deposit and withdraw | [optional] +**pnl** | **string** | total amount of trading profit and loss | [optional] +**fee** | **string** | total amount of fee | [optional] +**refr** | **string** | total amount of referrer rebates | [optional] +**fund** | **string** | total amount of funding costs | [optional] +**point_dnw** | **string** | total amount of point deposit and withdraw | [optional] +**point_fee** | **string** | total amount of point fee | [optional] +**point_refr** | **string** | total amount of referrer rebates of point fee | [optional] +**bonus_dnw** | **string** | total amount of perpetual contract bonus transfer | [optional] +**bonus_offset** | **string** | total amount of perpetual contract bonus deduction | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesAutoDeleverage.md b/docs/Model/FuturesAutoDeleverage.md new file mode 100644 index 0000000..8a3c3de --- /dev/null +++ b/docs/Model/FuturesAutoDeleverage.md @@ -0,0 +1,18 @@ +# # FuturesAutoDeleverage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **int** | Automatic deleveraging time | [optional] [readonly] +**user** | **int** | User ID | [optional] [readonly] +**order_id** | **int** | Order ID. Order IDs before 2023-02-20 are null | [optional] [readonly] +**contract** | **string** | Futures contract | [optional] [readonly] +**leverage** | **string** | Position leverage | [optional] [readonly] +**cross_leverage_limit** | **string** | Cross margin leverage(valid only when `leverage` is 0) | [optional] [readonly] +**entry_price** | **string** | Average entry price | [optional] [readonly] +**fill_price** | **string** | Average fill price | [optional] [readonly] +**trade_size** | **int** | Trading size | [optional] [readonly] +**position_size** | **int** | Positions after auto-deleveraging | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesCandlestick.md b/docs/Model/FuturesCandlestick.md index 65d26f0..2fe3111 100644 --- a/docs/Model/FuturesCandlestick.md +++ b/docs/Model/FuturesCandlestick.md @@ -5,10 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **t** | **double** | Unix timestamp in seconds | [optional] -**v** | **int** | size volume. Only returned if `contract` is not prefixed | [optional] -**c** | **string** | Close price | [optional] -**h** | **string** | Highest price | [optional] -**l** | **string** | Lowest price | [optional] -**o** | **string** | Open price | [optional] +**v** | **int** | size volume (contract size). Only returned if `contract` is not prefixed | [optional] +**c** | **string** | Close price (quote currency) | [optional] +**h** | **string** | Highest price (quote currency) | [optional] +**l** | **string** | Lowest price (quote currency) | [optional] +**o** | **string** | Open price (quote currency) | [optional] +**sum** | **string** | Trading volume (unit: Quote currency) | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesIndexConstituents.md b/docs/Model/FuturesIndexConstituents.md new file mode 100644 index 0000000..50a07b6 --- /dev/null +++ b/docs/Model/FuturesIndexConstituents.md @@ -0,0 +1,10 @@ +# # FuturesIndexConstituents + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **string** | Index name | [optional] [readonly] +**constituents** | [**\GateApi\Model\IndexConstituent[]**](IndexConstituent.md) | Constituents | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesInitialOrder.md b/docs/Model/FuturesInitialOrder.md index 237139a..e7dc0aa 100644 --- a/docs/Model/FuturesInitialOrder.md +++ b/docs/Model/FuturesInitialOrder.md @@ -10,7 +10,8 @@ Name | Type | Description | Notes **close** | **bool** | Set to true if trying to close the position | [optional] [default to false] **tif** | **string** | Time in force. If using market price, only `ioc` is supported. - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled | [optional] [default to 'gtc'] **text** | **string** | How the order is created. Possible values are: web, api and app | [optional] -**reduce_only** | **bool** | Set to true to create an reduce-only order | [optional] [default to false] +**reduce_only** | **bool** | Set to true to create a reduce-only order | [optional] [default to false] +**auto_size** | **string** | Set side to close dual-mode position. `close_long` closes the long side; while `close_short` the short one. Note `size` also needs to be set to 0 | [optional] **is_reduce_only** | **bool** | Is the order reduce-only | [optional] [readonly] **is_close** | **bool** | Is the order to close position | [optional] [readonly] diff --git a/docs/Model/FuturesOrder.md b/docs/Model/FuturesOrder.md index e9ca358..b4afdf4 100644 --- a/docs/Model/FuturesOrder.md +++ b/docs/Model/FuturesOrder.md @@ -6,25 +6,26 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | Futures order ID | [optional] [readonly] **user** | **int** | User ID | [optional] [readonly] -**create_time** | **double** | Order creation time | [optional] [readonly] +**create_time** | **double** | Creation time of order | [optional] [readonly] **finish_time** | **double** | Order finished time. Not returned if order is open | [optional] [readonly] -**finish_as** | **string** | How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close | [optional] [readonly] +**finish_as** | **string** | How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close | [optional] [readonly] **status** | **string** | Order status - `open`: waiting to be traded - `finished`: finished | [optional] [readonly] **contract** | **string** | Futures contract | **size** | **int** | Order size. Specify positive number to make a bid, and negative number to ask | -**iceberg** | **int** | Display size for iceberg order. 0 for non-iceberg. Note that you would pay the taker fee for the hidden size | [optional] +**iceberg** | **int** | Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size | [optional] **price** | **string** | Order price. 0 for market order with `tif` set as `ioc` | [optional] **close** | **bool** | Set as `true` to close the position, with `size` set to 0 | [optional] [default to false] **is_close** | **bool** | Is the order to close position | [optional] [readonly] **reduce_only** | **bool** | Set as `true` to be reduce-only order | [optional] [default to false] **is_reduce_only** | **bool** | Is the order reduce-only | [optional] [readonly] **is_liq** | **bool** | Is the order for liquidation | [optional] [readonly] -**tif** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, reduce-only | [optional] [default to 'gtc'] +**tif** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none | [optional] [default to 'gtc'] **left** | **int** | Size left to be traded | [optional] [readonly] **fill_price** | **string** | Fill price of the order | [optional] [readonly] **text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance | [optional] **tkfr** | **string** | Taker fee | [optional] [readonly] **mkfr** | **string** | Maker fee | [optional] [readonly] **refu** | **int** | Reference user ID | [optional] [readonly] +**auto_size** | **string** | Set side to close dual-mode position. `close_long` closes the long side; while `close_short` the short one. Note `size` also needs to be set to 0 | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesOrderAmendment.md b/docs/Model/FuturesOrderAmendment.md new file mode 100644 index 0000000..b2eb6eb --- /dev/null +++ b/docs/Model/FuturesOrderAmendment.md @@ -0,0 +1,10 @@ +# # FuturesOrderAmendment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | New order size, including filled part. - If new size is less than or equal to filled size, the order will be cancelled. - Order side must be identical to the original one. - Close order size cannot be changed. - For reduce only orders, increasing size may leads to other reduce only orders being cancelled. - If price is not changed, decreasing size will not change its precedence in order book, while increasing will move it to the last at current price. | [optional] +**price** | **string** | New order price. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesOrderBook.md b/docs/Model/FuturesOrderBook.md index 784ae89..62f4cc6 100644 --- a/docs/Model/FuturesOrderBook.md +++ b/docs/Model/FuturesOrderBook.md @@ -4,7 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | Order Book ID. Increase by 1 on every order book change. Set `with_id=true` to include this field in response | [optional] +**id** | **int** | Order Book ID. Increases by 1 on every order book change. Set `with_id=true` to include this field in response | [optional] +**current** | **double** | Response data generation timestamp | [optional] +**update** | **double** | Order book changed timestamp | [optional] **asks** | [**\GateApi\Model\FuturesOrderBookItem[]**](FuturesOrderBookItem.md) | Asks order depth | **bids** | [**\GateApi\Model\FuturesOrderBookItem[]**](FuturesOrderBookItem.md) | Bids order depth | diff --git a/docs/Model/FuturesOrderBookItem.md b/docs/Model/FuturesOrderBookItem.md index ed8bd38..749564e 100644 --- a/docs/Model/FuturesOrderBookItem.md +++ b/docs/Model/FuturesOrderBookItem.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**p** | **string** | Price | [optional] +**p** | **string** | Price (quote currency) | [optional] **s** | **int** | Size | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesPremiumIndex.md b/docs/Model/FuturesPremiumIndex.md new file mode 100644 index 0000000..df94c3c --- /dev/null +++ b/docs/Model/FuturesPremiumIndex.md @@ -0,0 +1,13 @@ +# # FuturesPremiumIndex + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**t** | **double** | Unix timestamp in seconds | [optional] +**c** | **string** | Close price | [optional] +**h** | **string** | Highest price | [optional] +**l** | **string** | Lowest price` | [optional] +**o** | **string** | Open price | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesPriceTrigger.md b/docs/Model/FuturesPriceTrigger.md index 4effb7a..04ec6aa 100644 --- a/docs/Model/FuturesPriceTrigger.md +++ b/docs/Model/FuturesPriceTrigger.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**strategy_type** | **int** | How the order will be triggered - `0`: by price, which means order will be triggered on price condition satisfied - `1`: by price gap, which means order will be triggered on gap of recent two prices of specified `price_type` satisfied. Only `0` is supported currently | [optional] +**strategy_type** | **int** | How the order will be triggered - `0`: by price, which means the order will be triggered if price condition is satisfied - `1`: by price gap, which means the order will be triggered if gap of recent two prices of specified `price_type` are satisfied. Only `0` is supported currently | [optional] **price_type** | **int** | Price type. 0 - latest deal price, 1 - mark price, 2 - index price | [optional] **price** | **string** | Value of price on price triggered, or price gap on price gap triggered | [optional] **rule** | **int** | Trigger condition type - `1`: calculated price based on `strategy_type` and `price_type` >= `price` - `2`: calculated price based on `strategy_type` and `price_type` <= `price` | [optional] -**expiration** | **int** | How many seconds will the order wait for the condition being triggered. Order will be cancelled on timed out | [optional] +**expiration** | **int** | How long (in seconds) to wait for the condition to be triggered before cancelling the order. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesPriceTriggeredOrder.md b/docs/Model/FuturesPriceTriggeredOrder.md index 1164784..c5f9bb3 100644 --- a/docs/Model/FuturesPriceTriggeredOrder.md +++ b/docs/Model/FuturesPriceTriggeredOrder.md @@ -11,8 +11,10 @@ Name | Type | Description | Notes **create_time** | **double** | Creation time | [optional] [readonly] **finish_time** | **double** | Finished time | [optional] [readonly] **trade_id** | **int** | ID of the newly created order on condition triggered | [optional] [readonly] -**status** | **string** | Order status. | [optional] [readonly] +**status** | **string** | Auto order status - `open`: order is active - `finished`: order is finished - `inactive`: order is not active, only for close-long-order or close-short-order - `invalid`: order is invalid, only for close-long-order or close-short-order | [optional] [readonly] **finish_as** | **string** | How order is finished | [optional] [readonly] -**reason** | **string** | Extra messages of how order is finished | [optional] [readonly] +**reason** | **string** | Additional remarks on how the order was finished | [optional] [readonly] +**order_type** | **string** | Take-profit/stop-loss types, which include: - `close-long-order`: order take-profit/stop-loss, close long position - `close-short-order`: order take-profit/stop-loss, close short position - `close-long-position`: position take-profit/stop-loss, close long position - `close-short-position`: position take-profit/stop-loss, close short position - `plan-close-long-position`: position planned take-profit/stop-loss, close long position - `plan-close-short-position`: position planned take-profit/stop-loss, close short position The order take-profit/stop-loss can not be passed by request. These two types are read only. | [optional] +**me_order_id** | **string** | Corresponding order ID of order take-profit/stop-loss. | [optional] [readonly] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesTicker.md b/docs/Model/FuturesTicker.md index a8e83ae..0b32a71 100644 --- a/docs/Model/FuturesTicker.md +++ b/docs/Model/FuturesTicker.md @@ -20,6 +20,8 @@ Name | Type | Description | Notes **funding_rate** | **string** | Funding rate | [optional] **funding_rate_indicative** | **string** | Indicative Funding rate in next period | [optional] **index_price** | **string** | Index price | [optional] -**quanto_base_rate** | **string** | Exchange rate of base currency and settlement currency in Quanto contract. Not existed in contract of other types | [optional] +**quanto_base_rate** | **string** | Exchange rate of base currency and settlement currency in Quanto contract. Does not exists in contracts of other types | [optional] +**basis_rate** | **string** | Basis rate | [optional] +**basis_value** | **string** | Basis value | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FuturesTrade.md b/docs/Model/FuturesTrade.md index 4d6b116..057d5b4 100644 --- a/docs/Model/FuturesTrade.md +++ b/docs/Model/FuturesTrade.md @@ -9,6 +9,6 @@ Name | Type | Description | Notes **create_time_ms** | **double** | Trading time, with milliseconds set to 3 decimal places. | [optional] **contract** | **string** | Futures contract | [optional] **size** | **int** | Trading size | [optional] -**price** | **string** | Trading price | [optional] +**price** | **string** | Trading price (quote currency) | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/IndexConstituent.md b/docs/Model/IndexConstituent.md new file mode 100644 index 0000000..67be342 --- /dev/null +++ b/docs/Model/IndexConstituent.md @@ -0,0 +1,10 @@ +# # IndexConstituent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchange** | **string** | Exchange | [optional] +**symbols** | **string[]** | Symbol list | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LedgerRecord.md b/docs/Model/LedgerRecord.md index 4376cbb..492848e 100644 --- a/docs/Model/LedgerRecord.md +++ b/docs/Model/LedgerRecord.md @@ -6,12 +6,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **string** | Record ID | [optional] [readonly] **txid** | **string** | Hash record of the withdrawal | [optional] [readonly] +**withdraw_order_id** | **string** | Client order id, up to 32 length and can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) | [optional] **timestamp** | **string** | Operation time | [optional] [readonly] **amount** | **string** | Currency amount | **currency** | **string** | Currency name | **address** | **string** | Withdrawal address. Required for withdrawals | [optional] -**memo** | **string** | Extra withdrawal memo | [optional] -**status** | **string** | Record status. - DONE: done - CANCEL: cancelled - REQUEST: requesting - MANUAL: waiting for manual approval - BCODE: GateCode operation | [optional] [readonly] -**chain** | **string** | Name of the chain used in withdrawals | [optional] +**memo** | **string** | Additional remarks with regards to the withdrawal | [optional] +**status** | **string** | Record status. - DONE: done - CANCEL: cancelled - REQUEST: requesting - MANUAL: pending manual approval - BCODE: GateCode operation - EXTPEND: pending confirm after sending - FAIL: pending confirm when fail - INVALID: invalid order - VERIFY: verifying - PROCES: processing - PEND: pending - DMOVE: required manual approval - SPLITPEND: the order is automatically split due to large amount | [optional] [readonly] +**chain** | **string** | Name of the chain used in withdrawals | +**fee** | **string** | Fee | [optional] [readonly] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LiquidateOrder.md b/docs/Model/LiquidateOrder.md new file mode 100644 index 0000000..9a1089b --- /dev/null +++ b/docs/Model/LiquidateOrder.md @@ -0,0 +1,12 @@ +# # LiquidateOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) | [optional] +**currency_pair** | **string** | Currency pair | +**amount** | **string** | Trade amount | +**price** | **string** | Order price | + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Loan.md b/docs/Model/Loan.md index d902925..b17fd40 100644 --- a/docs/Model/Loan.md +++ b/docs/Model/Loan.md @@ -10,16 +10,17 @@ Name | Type | Description | Notes **status** | **string** | Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system | [optional] [readonly] **side** | **string** | Loan side | **currency** | **string** | Loan currency | -**rate** | **string** | Loan rate. Only rates in [0.0002, 0.002] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set | [optional] +**rate** | **string** | Loan rate. Only rates in [0.0001, 0.01] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set | [optional] **amount** | **string** | Loan amount | -**days** | **int** | Loan days | -**auto_renew** | **bool** | Auto renew the loan on expiration | [optional] [default to false] -**currency_pair** | **string** | Currency pair. Required for borrowing side | [optional] -**left** | **string** | Amount not lending out | [optional] [readonly] +**days** | **int** | Loan days. Only 10 is supported for now | [optional] +**auto_renew** | **bool** | Whether to auto renew the loan upon expiration | [optional] [default to false] +**currency_pair** | **string** | Currency pair. Required if borrowing | [optional] +**left** | **string** | Amount not lent out yet | [optional] [readonly] **repaid** | **string** | Repaid amount | [optional] [readonly] **paid_interest** | **string** | Repaid interest | [optional] [readonly] -**unpaid_interest** | **string** | Interest not repaid | [optional] [readonly] +**unpaid_interest** | **string** | Outstanding interest yet to be paid | [optional] [readonly] **fee_rate** | **string** | Loan fee rate | [optional] -**orig_id** | **string** | Original loan ID if the loan is auto-renewed. Equal to `id` if not | [optional] +**orig_id** | **string** | Original loan ID of the loan if auto-renewed, otherwise equals to id | [optional] +**text** | **string** | User defined custom ID | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoanPatch.md b/docs/Model/LoanPatch.md index 402f893..478e798 100644 --- a/docs/Model/LoanPatch.md +++ b/docs/Model/LoanPatch.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **currency** | **string** | Loan currency | **side** | **string** | Loan side. Possible values are `lend` and `borrow`. For `LoanRecord` patching, only `lend` is supported | **auto_renew** | **bool** | Auto renew | -**currency_pair** | **string** | Currency pair. Required for borrowing side | [optional] +**currency_pair** | **string** | Currency pair. Required if borrowing | [optional] **loan_id** | **string** | Loan ID. Required for `LoanRecord` patching | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoanRecord.md b/docs/Model/LoanRecord.md index b472692..ba9c6b4 100644 --- a/docs/Model/LoanRecord.md +++ b/docs/Model/LoanRecord.md @@ -17,6 +17,6 @@ Name | Type | Description | Notes **auto_renew** | **bool** | Whether the record will auto renew on expiration | [optional] [default to false] **repaid** | **string** | Repaid amount | [optional] **paid_interest** | **string** | Repaid interest | [optional] [readonly] -**unpaid_interest** | **string** | Interest not repaid | [optional] [readonly] +**unpaid_interest** | **string** | Outstanding interest yet to be paid | [optional] [readonly] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MarginAccount.md b/docs/Model/MarginAccount.md index 20aacb3..dfde663 100644 --- a/docs/Model/MarginAccount.md +++ b/docs/Model/MarginAccount.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency_pair** | **string** | Currency pair | [optional] +**locked** | **bool** | Whether account is locked | [optional] +**risk** | **string** | Current risk rate of margin account | [optional] **base** | [**\GateApi\Model\MarginAccountCurrency**](MarginAccountCurrency.md) | | [optional] **quote** | [**\GateApi\Model\MarginAccountCurrency**](MarginAccountCurrency.md) | | [optional] diff --git a/docs/Model/MarginAccountBook.md b/docs/Model/MarginAccountBook.md index a24b485..e2260d4 100644 --- a/docs/Model/MarginAccountBook.md +++ b/docs/Model/MarginAccountBook.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **string** | Balance change record ID | [optional] **time** | **string** | Balance changed timestamp | [optional] +**time_ms** | **int** | The timestamp of the change (in milliseconds) | [optional] **currency** | **string** | Currency changed | [optional] **currency_pair** | **string** | Account currency pair | [optional] **change** | **string** | Amount changed. Positive value means transferring in, while negative out | [optional] diff --git a/docs/Model/MarginAccountCurrency.md b/docs/Model/MarginAccountCurrency.md index 02fc7ac..4c836ea 100644 --- a/docs/Model/MarginAccountCurrency.md +++ b/docs/Model/MarginAccountCurrency.md @@ -8,6 +8,6 @@ Name | Type | Description | Notes **available** | **string** | Amount suitable for margin trading. | [optional] **locked** | **string** | Locked amount, used in margin trading | [optional] **borrowed** | **string** | Borrowed amount | [optional] -**interest** | **string** | Interests unpaid | [optional] +**interest** | **string** | Unpaid interests | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MarginBorrowable.md b/docs/Model/MarginBorrowable.md new file mode 100644 index 0000000..919dce1 --- /dev/null +++ b/docs/Model/MarginBorrowable.md @@ -0,0 +1,11 @@ +# # MarginBorrowable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency detail | [optional] +**currency_pair** | **string** | Currency pair | [optional] +**amount** | **string** | Max borrowable amount | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MarginCurrencyPair.md b/docs/Model/MarginCurrencyPair.md index 8c6babc..b9a2542 100644 --- a/docs/Model/MarginCurrencyPair.md +++ b/docs/Model/MarginCurrencyPair.md @@ -11,5 +11,6 @@ Name | Type | Description | Notes **min_base_amount** | **string** | Minimum base currency to loan, `null` means no limit | [optional] **min_quote_amount** | **string** | Minimum quote currency to loan, `null` means no limit | [optional] **max_quote_amount** | **string** | Maximum borrowable amount for quote currency. Base currency limit is calculated by quote maximum and market price. `null` means no limit | [optional] +**status** | **int** | Currency pair status - `0`: disabled - `1`: enabled | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MarginTransferable.md b/docs/Model/MarginTransferable.md new file mode 100644 index 0000000..33a3b1e --- /dev/null +++ b/docs/Model/MarginTransferable.md @@ -0,0 +1,11 @@ +# # MarginTransferable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency detail | [optional] +**currency_pair** | **string** | Currency pair | [optional] +**amount** | **string** | Max transferable amount | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChainAddressItem.md b/docs/Model/MultiChainAddressItem.md index e6641b1..7939428 100644 --- a/docs/Model/MultiChainAddressItem.md +++ b/docs/Model/MultiChainAddressItem.md @@ -8,6 +8,6 @@ Name | Type | Description | Notes **address** | **string** | Deposit address | [optional] **payment_id** | **string** | Notes that some currencies required(e.g., Tag, Memo) when depositing | [optional] **payment_name** | **string** | Note type, `Tag` or `Memo` | [optional] -**obtain_failed** | **int** | Whether address is obtained. 0 means success. 1 is failure, which needs retries | [optional] +**obtain_failed** | **int** | The obtain failed status- 0: address successfully obtained- 1: failed to obtain address | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MyFuturesTrade.md b/docs/Model/MyFuturesTrade.md index 1dbc14d..ff7e4a5 100644 --- a/docs/Model/MyFuturesTrade.md +++ b/docs/Model/MyFuturesTrade.md @@ -11,5 +11,8 @@ Name | Type | Description | Notes **size** | **int** | Trading size | [optional] **price** | **string** | Trading price | [optional] **role** | **string** | Trade role. Available values are `taker` and `maker` | [optional] +**text** | **string** | User defined information | [optional] +**fee** | **string** | Fee deducted | [optional] +**point_fee** | **string** | Points used to deduct fee | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsAccount.md b/docs/Model/OptionsAccount.md new file mode 100644 index 0000000..7f6e862 --- /dev/null +++ b/docs/Model/OptionsAccount.md @@ -0,0 +1,18 @@ +# # OptionsAccount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **int** | User ID | [optional] +**total** | **string** | Total account balance | [optional] +**short_enabled** | **bool** | If the account is allowed to short | [optional] +**unrealised_pnl** | **string** | Unrealized PNL | [optional] +**init_margin** | **string** | Initial position margin | [optional] +**maint_margin** | **string** | Position maintenance margin | [optional] +**order_margin** | **string** | Order margin of unfinished orders | [optional] +**available** | **string** | Available balance to transfer out or trade | [optional] +**point** | **string** | POINT amount | [optional] +**currency** | **string** | Settle currency | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsAccountBook.md b/docs/Model/OptionsAccountBook.md new file mode 100644 index 0000000..0605d9a --- /dev/null +++ b/docs/Model/OptionsAccountBook.md @@ -0,0 +1,13 @@ +# # OptionsAccountBook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **double** | Change time | [optional] +**change** | **string** | Amount changed (USDT) | [optional] +**balance** | **string** | Account total balance after change (USDT) | [optional] +**type** | **string** | Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] +**text** | **string** | custom text | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsCandlestick.md b/docs/Model/OptionsCandlestick.md new file mode 100644 index 0000000..6b5f48e --- /dev/null +++ b/docs/Model/OptionsCandlestick.md @@ -0,0 +1,14 @@ +# # OptionsCandlestick + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**t** | **double** | Unix timestamp in seconds | [optional] +**v** | **int** | size volume (contract size). Only returned if `contract` is not prefixed | [optional] +**c** | **string** | Close price (quote currency, unit: underlying corresponding option price) | [optional] +**h** | **string** | Highest price (quote currency, unit: underlying corresponding option price) | [optional] +**l** | **string** | Lowest price (quote currency, unit: underlying corresponding option price) | [optional] +**o** | **string** | Open price (quote currency, unit: underlying corresponding option price) | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsContract.md b/docs/Model/OptionsContract.md new file mode 100644 index 0000000..8853096 --- /dev/null +++ b/docs/Model/OptionsContract.md @@ -0,0 +1,33 @@ +# # OptionsContract + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Options contract name | [optional] +**tag** | **string** | tag | [optional] +**create_time** | **double** | Creation time | [optional] +**expiration_time** | **double** | Expiration time | [optional] +**is_call** | **bool** | `true` means call options, while `false` is put options | [optional] +**multiplier** | **string** | Multiplier used in converting from invoicing to settlement currency | [optional] +**underlying** | **string** | Underlying | [optional] +**underlying_price** | **string** | Underlying price (quote currency) | [optional] +**last_price** | **string** | Last trading price | [optional] +**mark_price** | **string** | Current mark price (quote currency) | [optional] +**index_price** | **string** | Current index price (quote currency) | [optional] +**maker_fee_rate** | **string** | Maker fee rate, where negative means rebate | [optional] +**taker_fee_rate** | **string** | Taker fee rate | [optional] +**order_price_round** | **string** | Minimum order price increment | [optional] +**mark_price_round** | **string** | Minimum mark price increment | [optional] +**order_size_min** | **int** | Minimum order size the contract allowed | [optional] +**order_size_max** | **int** | Maximum order size the contract allowed | [optional] +**order_price_deviate** | **string** | deviation between order price and current index price. If price of an order is denoted as order_price, it must meet the following condition: abs(order_price - mark_price) <= mark_price * order_price_deviate | [optional] +**ref_discount_rate** | **string** | Referral fee rate discount | [optional] +**ref_rebate_rate** | **string** | Referrer commission rate | [optional] +**orderbook_id** | **int** | Current orderbook ID | [optional] +**trade_id** | **int** | Current trade ID | [optional] +**trade_size** | **int** | Historical accumulated trade size | [optional] +**position_size** | **int** | Current total long position size | [optional] +**orders_limit** | **int** | Maximum number of open orders | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsMySettlements.md b/docs/Model/OptionsMySettlements.md new file mode 100644 index 0000000..cd2baab --- /dev/null +++ b/docs/Model/OptionsMySettlements.md @@ -0,0 +1,17 @@ +# # OptionsMySettlements + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **double** | Settlement time | [optional] +**underlying** | **string** | Underlying | [optional] +**contract** | **string** | Options contract name | [optional] +**strike_price** | **string** | Strike price (quote currency) | [optional] +**settle_price** | **string** | Settlement price (quote currency) | [optional] +**size** | **int** | Size | [optional] +**settle_profit** | **string** | Settlement profit (quote currency) | [optional] +**fee** | **string** | Fee (quote currency) | [optional] +**realised_pnl** | **string** | The accumulated profit and loss of opening a position, including premium, fee, settlement profit, etc. (quote currency) | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsMyTrade.md b/docs/Model/OptionsMyTrade.md new file mode 100644 index 0000000..55ca567 --- /dev/null +++ b/docs/Model/OptionsMyTrade.md @@ -0,0 +1,16 @@ +# # OptionsMyTrade + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Trade ID | [optional] +**create_time** | **double** | Trading time | [optional] +**contract** | **string** | Options contract name | [optional] +**order_id** | **int** | Order ID related | [optional] +**size** | **int** | Trading size | [optional] +**price** | **string** | Trading price (quote currency) | [optional] +**underlying_price** | **string** | Underlying price (quote currency) | [optional] +**role** | **string** | Trade role. Available values are `taker` and `maker` | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsOrder.md b/docs/Model/OptionsOrder.md new file mode 100644 index 0000000..ec4b464 --- /dev/null +++ b/docs/Model/OptionsOrder.md @@ -0,0 +1,31 @@ +# # OptionsOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Options order ID | [optional] [readonly] +**user** | **int** | User ID | [optional] [readonly] +**create_time** | **double** | Creation time of order | [optional] [readonly] +**finish_time** | **double** | Order finished time. Not returned if order is open | [optional] [readonly] +**finish_as** | **string** | How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close | [optional] [readonly] +**status** | **string** | Order status - `open`: waiting to be traded - `finished`: finished | [optional] [readonly] +**contract** | **string** | Contract name | +**size** | **int** | Order size. Specify positive number to make a bid, and negative number to ask | +**iceberg** | **int** | Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size | [optional] +**price** | **string** | Order price. 0 for market order with `tif` set as `ioc` (USDT) | [optional] +**close** | **bool** | Set as `true` to close the position, with `size` set to 0 | [optional] [default to false] +**is_close** | **bool** | Is the order to close position | [optional] [readonly] +**reduce_only** | **bool** | Set as `true` to be reduce-only order | [optional] [default to false] +**is_reduce_only** | **bool** | Is the order reduce-only | [optional] [readonly] +**is_liq** | **bool** | Is the order for liquidation | [optional] [readonly] +**tif** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee | [optional] [default to 'gtc'] +**left** | **int** | Size left to be traded | [optional] [readonly] +**fill_price** | **string** | Fill price of the order | [optional] [readonly] +**text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance | [optional] +**tkfr** | **string** | Taker fee | [optional] [readonly] +**mkfr** | **string** | Maker fee | [optional] [readonly] +**refu** | **int** | Reference user ID | [optional] [readonly] +**refr** | **string** | Referrer rebate | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsPosition.md b/docs/Model/OptionsPosition.md new file mode 100644 index 0000000..d5901fe --- /dev/null +++ b/docs/Model/OptionsPosition.md @@ -0,0 +1,17 @@ +# # OptionsPosition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | **int** | User ID | [optional] [readonly] +**contract** | **string** | Options contract name | [optional] [readonly] +**size** | **int** | Position size (contract size) | [optional] [readonly] +**entry_price** | **string** | Entry size (quote currency) | [optional] [readonly] +**mark_price** | **string** | Current mark price (quote currency) | [optional] [readonly] +**realised_pnl** | **string** | Realized PNL | [optional] [readonly] +**unrealised_pnl** | **string** | Unrealized PNL | [optional] [readonly] +**pending_orders** | **int** | Current open orders | [optional] [readonly] +**close_order** | [**\GateApi\Model\OptionsPositionCloseOrder**](OptionsPositionCloseOrder.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsPositionClose.md b/docs/Model/OptionsPositionClose.md new file mode 100644 index 0000000..d3c1425 --- /dev/null +++ b/docs/Model/OptionsPositionClose.md @@ -0,0 +1,14 @@ +# # OptionsPositionClose + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **double** | Position close time | [optional] [readonly] +**contract** | **string** | Options contract name | [optional] [readonly] +**side** | **string** | Position side, long or short | [optional] [readonly] +**pnl** | **string** | PNL | [optional] [readonly] +**text** | **string** | Text of close order | [optional] [readonly] +**settle_size** | **string** | settlement size | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsPositionCloseOrder.md b/docs/Model/OptionsPositionCloseOrder.md new file mode 100644 index 0000000..73cf7df --- /dev/null +++ b/docs/Model/OptionsPositionCloseOrder.md @@ -0,0 +1,11 @@ +# # OptionsPositionCloseOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Close order ID | [optional] +**price** | **string** | Close order price (quote currency) | [optional] +**is_liq** | **bool** | Is the close order from liquidation | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsSettlement.md b/docs/Model/OptionsSettlement.md new file mode 100644 index 0000000..f765d61 --- /dev/null +++ b/docs/Model/OptionsSettlement.md @@ -0,0 +1,14 @@ +# # OptionsSettlement + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **double** | Last changed time of configuration | [optional] +**contract** | **string** | Options contract name | [optional] +**profit** | **string** | Settlement profit per size (quote currency) | [optional] +**fee** | **string** | Settlement fee per size (quote currency) | [optional] +**strike_price** | **string** | Strike price (quote currency) | [optional] +**settle_price** | **string** | Settlement price (quote currency) | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsTicker.md b/docs/Model/OptionsTicker.md new file mode 100644 index 0000000..8c9f43c --- /dev/null +++ b/docs/Model/OptionsTicker.md @@ -0,0 +1,26 @@ +# # OptionsTicker + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Options contract name | [optional] +**last_price** | **string** | Last trading price (quote currency) | [optional] +**mark_price** | **string** | Current mark price (quote currency) | [optional] +**index_price** | **string** | Current index price (quote currency) | [optional] +**ask1_size** | **int** | Best ask size | [optional] +**ask1_price** | **string** | Best ask price | [optional] +**bid1_size** | **int** | Best bid size | [optional] +**bid1_price** | **string** | Best bid price | [optional] +**position_size** | **int** | Current total long position size | [optional] +**mark_iv** | **string** | Implied volatility | [optional] +**bid_iv** | **string** | Bid side implied volatility | [optional] +**ask_iv** | **string** | Ask side implied volatility | [optional] +**leverage** | **string** | Current leverage. Formula: underlying_price / mark_price * delta | [optional] +**delta** | **string** | Delta | [optional] +**gamma** | **string** | Gamma | [optional] +**vega** | **string** | Vega | [optional] +**theta** | **string** | Theta | [optional] +**rho** | **string** | Rho | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsUnderlying.md b/docs/Model/OptionsUnderlying.md new file mode 100644 index 0000000..b14c71e --- /dev/null +++ b/docs/Model/OptionsUnderlying.md @@ -0,0 +1,10 @@ +# # OptionsUnderlying + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Underlying name | [optional] +**index_price** | **string** | Spot index price (quote currency) | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptionsUnderlyingTicker.md b/docs/Model/OptionsUnderlyingTicker.md new file mode 100644 index 0000000..74416c0 --- /dev/null +++ b/docs/Model/OptionsUnderlyingTicker.md @@ -0,0 +1,11 @@ +# # OptionsUnderlyingTicker + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**trade_put** | **int** | Total put options trades amount in last 24h | [optional] +**trade_call** | **int** | Total call options trades amount in last 24h | [optional] +**index_price** | **string** | Index price (quote currency) | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Order.md b/docs/Model/Order.md index f0ae3e3..b68f49c 100644 --- a/docs/Model/Order.md +++ b/docs/Model/Order.md @@ -5,29 +5,32 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **string** | Order ID | [optional] [readonly] -**text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) | [optional] -**create_time** | **string** | Order creation time | [optional] [readonly] -**update_time** | **string** | Order last modification time | [optional] [readonly] -**create_time_ms** | **int** | Order creation time in milliseconds | [optional] [readonly] -**update_time_ms** | **int** | Order last modification time in milliseconds | [optional] [readonly] +**text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - 101: from android - 102: from IOS - 103: from IPAD - 104: from webapp - 3: from web - 2: from apiv2 - apiv4: from apiv4 | [optional] +**create_time** | **string** | Creation time of order | [optional] [readonly] +**update_time** | **string** | Last modification time of order | [optional] [readonly] +**create_time_ms** | **int** | Creation time of order (in milliseconds) | [optional] [readonly] +**update_time_ms** | **int** | Last modification time of order (in milliseconds) | [optional] [readonly] **status** | **string** | Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled | [optional] [readonly] **currency_pair** | **string** | Currency pair | -**type** | **string** | Order type. limit - limit order | [optional] [default to 'limit'] -**account** | **string** | Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account | [optional] [default to 'spot'] +**type** | **string** | Order Type - limit : Limit Order - market : Market Order | [optional] [default to 'limit'] +**account** | **string** | Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account. Portfolio margin account must set to `cross-margin` | [optional] [default to 'spot'] **side** | **string** | Order side | -**amount** | **string** | Trade amount | -**price** | **string** | Order price | -**time_in_force** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee | [optional] [default to 'gtc'] -**iceberg** | **string** | Amount to display for the iceberg order. Null or 0 for normal orders. Set to -1 to hide the amount totally | [optional] +**amount** | **string** | When `type` is limit, it refers to base currency. For instance, `BTC_USDT` means `BTC` When `type` is `market`, it refers to different currency according to `side` - `side` : `buy` means quote currency, `BTC_USDT` means `USDT` - `side` : `sell` means base currency,`BTC_USDT` means `BTC` | +**price** | **string** | Price can't be empty when `type`= `limit` | [optional] +**time_in_force** | **string** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none Only `ioc` and `fok` are supported when `type`=`market` | [optional] [default to 'gtc'] +**iceberg** | **string** | Amount to display for the iceberg order. Null or 0 for normal orders. Hiding all amount is not supported. | [optional] **auto_borrow** | **bool** | Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. | [optional] **auto_repay** | **bool** | Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. | [optional] **left** | **string** | Amount left to fill | [optional] [readonly] **fill_price** | **string** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] [readonly] **filled_total** | **string** | Total filled in quote currency | [optional] [readonly] +**avg_deal_price** | **string** | Average fill price | [optional] [readonly] **fee** | **string** | Fee deducted | [optional] [readonly] **fee_currency** | **string** | Fee currency unit | [optional] [readonly] -**point_fee** | **string** | Point used to deduct fee | [optional] [readonly] +**point_fee** | **string** | Points used to deduct fee | [optional] [readonly] **gt_fee** | **string** | GT used to deduct fee | [optional] [readonly] +**gt_maker_fee** | **string** | GT used to deduct maker fee | [optional] [readonly] +**gt_taker_fee** | **string** | GT used to deduct taker fee | [optional] [readonly] **gt_discount** | **bool** | Whether GT fee discount is used | [optional] [readonly] **rebated_fee** | **string** | Rebated fee | [optional] [readonly] **rebated_fee_currency** | **string** | Rebated fee currency unit | [optional] [readonly] diff --git a/docs/Model/OrderBook.md b/docs/Model/OrderBook.md index d7ec33a..2469529 100644 --- a/docs/Model/OrderBook.md +++ b/docs/Model/OrderBook.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | Order book ID, which is updated whenever the order book is changed. Valid only when `with_id` is set to `true` | [optional] +**current** | **int** | The timestamp of the response data being generated (in milliseconds) | [optional] +**update** | **int** | The timestamp of when the orderbook last changed (in milliseconds) | [optional] **asks** | [**string[][]**](array.md) | Asks order depth | **bids** | [**string[][]**](array.md) | Bids order depth | diff --git a/docs/Model/OrderPatch.md b/docs/Model/OrderPatch.md new file mode 100644 index 0000000..94f2c25 --- /dev/null +++ b/docs/Model/OrderPatch.md @@ -0,0 +1,10 @@ +# # OrderPatch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **string** | New order amount. `amount` and `price` must specify one of them | [optional] +**price** | **string** | New order price. `amount` and `Price` must specify one of them\" | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Position.md b/docs/Model/Position.md index 56038e0..71bb937 100644 --- a/docs/Model/Position.md +++ b/docs/Model/Position.md @@ -16,13 +16,15 @@ Name | Type | Description | Notes **entry_price** | **string** | Entry price | [optional] [readonly] **liq_price** | **string** | Liquidation price | [optional] [readonly] **mark_price** | **string** | Current mark price | [optional] [readonly] +**initial_margin** | **string** | The initial margin occupied by the position, applicable to the portfolio margin account | [optional] [readonly] +**maintenance_margin** | **string** | Maintenance margin required for the position, applicable to portfolio margin account | [optional] [readonly] **unrealised_pnl** | **string** | Unrealized PNL | [optional] [readonly] **realised_pnl** | **string** | Realized PNL | [optional] [readonly] **history_pnl** | **string** | History realized PNL | [optional] [readonly] **last_close_pnl** | **string** | PNL of last position close | [optional] [readonly] **realised_point** | **string** | Realized POINT PNL | [optional] [readonly] **history_point** | **string** | History realized POINT PNL | [optional] [readonly] -**adl_ranking** | **int** | ADL ranking, range from 1 to 5 | [optional] [readonly] +**adl_ranking** | **int** | ADL ranking, ranging from 1 to 5 | [optional] [readonly] **pending_orders** | **int** | Current open orders | [optional] [readonly] **close_order** | [**\GateApi\Model\PositionCloseOrder**](PositionCloseOrder.md) | | [optional] **mode** | **string** | Position mode, including: - `single`: dual mode is not enabled- `dual_long`: long position in dual mode- `dual_short`: short position in dual mode | [optional] diff --git a/docs/Model/SavedAddress.md b/docs/Model/SavedAddress.md new file mode 100644 index 0000000..3387dd0 --- /dev/null +++ b/docs/Model/SavedAddress.md @@ -0,0 +1,14 @@ +# # SavedAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Currency | [optional] +**chain** | **string** | Chain name | [optional] +**address** | **string** | Address | [optional] +**name** | **string** | Name | [optional] +**tag** | **string** | Tag | [optional] +**verified** | **string** | Whether to pass the verification 0-unverified, 1-verified | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SpotFee.md b/docs/Model/SpotFee.md new file mode 100644 index 0000000..a330400 --- /dev/null +++ b/docs/Model/SpotFee.md @@ -0,0 +1,17 @@ +# # SpotFee + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user_id** | **int** | User ID | [optional] +**taker_fee** | **string** | taker fee rate | [optional] +**maker_fee** | **string** | maker fee rate | [optional] +**gt_discount** | **bool** | If GT deduction is enabled | [optional] +**gt_taker_fee** | **string** | Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional] +**gt_maker_fee** | **string** | Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional] +**loan_fee** | **string** | Loan fee rate of margin lending | [optional] +**point_type** | **string** | Point type. 0 - Initial version. 1 - new version since 202009 | [optional] +**currency_pair** | **string** | Currency pair | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SpotPricePutOrder.md b/docs/Model/SpotPricePutOrder.md index f5c5d14..be92ba1 100644 --- a/docs/Model/SpotPricePutOrder.md +++ b/docs/Model/SpotPricePutOrder.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **side** | **string** | Order side - buy: buy side - sell: sell side | **price** | **string** | Order price | **amount** | **string** | Order amount | -**account** | **string** | Trading type - normal: spot trading - margin: margin trading | -**time_in_force** | **string** | time_in_force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only | [optional] +**account** | **string** | Trading account type. Portfolio margin account must set to `cross_margin` - normal: spot trading - margin: margin trading - cross_margin: cross_margin trading | [default to 'normal'] +**time_in_force** | **string** | time_in_force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only | [optional] [default to 'gtc'] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SpotPriceTrigger.md b/docs/Model/SpotPriceTrigger.md index a6a50ed..2063c5c 100644 --- a/docs/Model/SpotPriceTrigger.md +++ b/docs/Model/SpotPriceTrigger.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **price** | **string** | Trigger price | **rule** | **string** | Price trigger condition - >=: triggered when market price larger than or equal to `price` field - <=: triggered when market price less than or equal to `price` field | -**expiration** | **int** | How many seconds will the order wait for the condition being triggered. Order will be cancelled on timed out | +**expiration** | **int** | How long (in seconds) to wait for the condition to be triggered before cancelling the order. | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SpotPriceTriggeredOrder.md b/docs/Model/SpotPriceTriggeredOrder.md index a793d67..a935e44 100644 --- a/docs/Model/SpotPriceTriggeredOrder.md +++ b/docs/Model/SpotPriceTriggeredOrder.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **id** | **int** | Auto order ID | [optional] [readonly] **user** | **int** | User ID | [optional] [readonly] **market** | **string** | Currency pair | -**ctime** | **double** | Creation time | [optional] [readonly] -**ftime** | **double** | Finished time | [optional] [readonly] +**ctime** | **int** | Creation time | [optional] [readonly] +**ftime** | **int** | Finished time | [optional] [readonly] **fired_order_id** | **int** | ID of the newly created order on condition triggered | [optional] [readonly] **status** | **string** | Status - open: open - cancelled: being manually cancelled - finish: successfully executed - failed: failed to execute - expired - expired | [optional] [readonly] -**reason** | **string** | Extra messages of how order is finished | [optional] [readonly] +**reason** | **string** | Additional remarks on how the order was finished | [optional] [readonly] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccount.md b/docs/Model/SubAccount.md new file mode 100644 index 0000000..d60ea2b --- /dev/null +++ b/docs/Model/SubAccount.md @@ -0,0 +1,16 @@ +# # SubAccount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**remark** | **string** | custom text | [optional] +**login_name** | **string** | Sub-account login name: Only letters, numbers and underscores are supported, and cannot contain other illegal characters | +**password** | **string** | The sub-account's password. (Default: the same as main account's password) | [optional] +**email** | **string** | The sub-account's email address. (Default: the same as main account's email address) | [optional] +**state** | **int** | State: 1-normal, 2-locked\" | [optional] [readonly] +**type** | **int** | Type: 1-Sub-account | [optional] +**user_id** | **int** | The user id of the sub-account | [optional] [readonly] +**create_time** | **int** | Created time | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountCrossMarginBalance.md b/docs/Model/SubAccountCrossMarginBalance.md new file mode 100644 index 0000000..4576883 --- /dev/null +++ b/docs/Model/SubAccountCrossMarginBalance.md @@ -0,0 +1,10 @@ +# # SubAccountCrossMarginBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uid** | **string** | User ID | [optional] +**available** | [**\GateApi\Model\SubCrossMarginAccount**](.md) | 账户余额信息 | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountFuturesBalance.md b/docs/Model/SubAccountFuturesBalance.md new file mode 100644 index 0000000..87a5299 --- /dev/null +++ b/docs/Model/SubAccountFuturesBalance.md @@ -0,0 +1,10 @@ +# # SubAccountFuturesBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uid** | **string** | User ID | [optional] +**available** | [**map[string,\GateApi\Model\FuturesAccount]**](FuturesAccount.md) | Futures account balances | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountKey.md b/docs/Model/SubAccountKey.md new file mode 100644 index 0000000..916d946 --- /dev/null +++ b/docs/Model/SubAccountKey.md @@ -0,0 +1,16 @@ +# # SubAccountKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user_id** | **string** | User ID | [optional] [readonly] +**name** | **string** | API key name | [optional] +**perms** | [**\GateApi\Model\ApiV4KeyPerm[]**](ApiV4KeyPerm.md) | | [optional] +**ip_whitelist** | **string[]** | ip white list (list will be removed if no value is passed) | [optional] +**key** | **string** | API Key | [optional] [readonly] +**state** | **int** | State 1 - normal 2 - locked 3 - frozen | [optional] [readonly] +**created_at** | **string** | Creation time | [optional] [readonly] +**updated_at** | **string** | Last update time | [optional] [readonly] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountMarginBalance.md b/docs/Model/SubAccountMarginBalance.md new file mode 100644 index 0000000..7454b32 --- /dev/null +++ b/docs/Model/SubAccountMarginBalance.md @@ -0,0 +1,10 @@ +# # SubAccountMarginBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uid** | **string** | User ID | [optional] +**available** | [**\GateApi\Model\MarginAccount[]**](MarginAccount.md) | Margin account balances | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountToSubAccount.md b/docs/Model/SubAccountToSubAccount.md new file mode 100644 index 0000000..801fcb5 --- /dev/null +++ b/docs/Model/SubAccountToSubAccount.md @@ -0,0 +1,15 @@ +# # SubAccountToSubAccount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **string** | Transfer currency name | +**sub_account_type** | **string** | Transfer from the account. (deprecate, use `sub_account_from_type` and `sub_account_to_type` instead) | [optional] +**sub_account_from** | **string** | Transfer from the user id of the sub-account | +**sub_account_from_type** | **string** | Transfer from the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account | +**sub_account_to** | **string** | Transfer to the user id of the sub-account | +**sub_account_to_type** | **string** | Transfer to the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account | +**amount** | **string** | Transfer amount | + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubAccountTransfer.md b/docs/Model/SubAccountTransfer.md index 8cfbf5d..3ee0166 100644 --- a/docs/Model/SubAccountTransfer.md +++ b/docs/Model/SubAccountTransfer.md @@ -11,6 +11,6 @@ Name | Type | Description | Notes **uid** | **string** | Main account user ID | [optional] [readonly] **timest** | **string** | Transfer timestamp | [optional] [readonly] **source** | **string** | Where the operation is initiated from | [optional] [readonly] -**sub_account_type** | **string** | Target sub user's account. `spot` - spot account, `futures` - perpetual contract account | [optional] [default to 'spot'] +**sub_account_type** | **string** | Target sub user's account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account | [optional] [default to 'spot'] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SubCrossMarginAccount.md b/docs/Model/SubCrossMarginAccount.md new file mode 100644 index 0000000..56ed987 --- /dev/null +++ b/docs/Model/SubCrossMarginAccount.md @@ -0,0 +1,24 @@ +# # SubCrossMarginAccount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user_id** | **int** | User ID of the cross margin account. 0 means that the subaccount has not yet opened a cross margin account | [optional] +**locked** | **bool** | Whether account is locked | [optional] +**balances** | [**map[string,\GateApi\Model\CrossMarginBalance]**](CrossMarginBalance.md) | | [optional] +**total** | **string** | Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` | [optional] +**borrowed** | **string** | Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` | [optional] +**borrowed_net** | **string** | Total borrowed value in USDT * borrowed factor | [optional] +**net** | **string** | Total net assets in USDT | [optional] +**leverage** | **string** | Position leverage | [optional] +**interest** | **string** | Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` | [optional] +**risk** | **string** | Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` | [optional] +**total_initial_margin** | **string** | Total initial margin | [optional] +**total_margin_balance** | **string** | Total margin balance | [optional] +**total_maintenance_margin** | **string** | Total maintenance margin | [optional] +**total_initial_margin_rate** | **string** | Total initial margin rate | [optional] +**total_maintenance_margin_rate** | **string** | Total maintenance margin rate | [optional] +**total_available_margin** | **string** | Total available margin | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SystemTime.md b/docs/Model/SystemTime.md new file mode 100644 index 0000000..fb397a4 --- /dev/null +++ b/docs/Model/SystemTime.md @@ -0,0 +1,9 @@ +# # SystemTime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**server_time** | **int** | Server current time(ms) | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Ticker.md b/docs/Model/Ticker.md index 123d2d3..b051559 100644 --- a/docs/Model/Ticker.md +++ b/docs/Model/Ticker.md @@ -6,11 +6,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency_pair** | **string** | Currency pair | [optional] **last** | **string** | Last trading price | [optional] -**lowest_ask** | **string** | Lowest ask | [optional] -**highest_bid** | **string** | Highest bid | [optional] -**change_percentage** | **string** | Change percentage. | [optional] -**base_volume** | **string** | Base currency trade volume | [optional] -**quote_volume** | **string** | Quote currency trade volume | [optional] +**lowest_ask** | **string** | Recent lowest ask | [optional] +**highest_bid** | **string** | Recent highest bid | [optional] +**change_percentage** | **string** | Change percentage in the last 24h | [optional] +**change_utc0** | **string** | utc0 timezone, the percentage change in the last 24 hours | [optional] +**change_utc8** | **string** | utc8 timezone, the percentage change in the last 24 hours | [optional] +**base_volume** | **string** | Base currency trade volume in the last 24h | [optional] +**quote_volume** | **string** | Quote currency trade volume in the last 24h | [optional] **high_24h** | **string** | Highest price in 24h | [optional] **low_24h** | **string** | Lowest price in 24h | [optional] **etf_net_value** | **string** | ETF net value | [optional] diff --git a/docs/Model/TotalBalance.md b/docs/Model/TotalBalance.md new file mode 100644 index 0000000..319cc6c --- /dev/null +++ b/docs/Model/TotalBalance.md @@ -0,0 +1,10 @@ +# # TotalBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | [**\GateApi\Model\AccountBalance**](AccountBalance.md) | | [optional] +**details** | [**map[string,\GateApi\Model\AccountBalance]**](AccountBalance.md) | Total balances in different accounts - cross_margin: cross margin account - spot: spot account - finance: finance account - margin: margin account - quant: quant account - futures: futures account - delivery: delivery account - warrant: warrant account - cbbc: cbbc account | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Trade.md b/docs/Model/Trade.md index dfc04c9..4a89eff 100644 --- a/docs/Model/Trade.md +++ b/docs/Model/Trade.md @@ -7,14 +7,15 @@ Name | Type | Description | Notes **id** | **string** | Trade ID | [optional] **create_time** | **string** | Trading time | [optional] **create_time_ms** | **string** | Trading time, with millisecond precision | [optional] +**currency_pair** | **string** | Currency pair | [optional] **side** | **string** | Order side | [optional] -**role** | **string** | Trade role | [optional] +**role** | **string** | Trade role. No value in public endpoints | [optional] **amount** | **string** | Trade amount | [optional] **price** | **string** | Order price | [optional] **order_id** | **string** | Related order ID. No value in public endpoints | [optional] **fee** | **string** | Fee deducted. No value in public endpoints | [optional] **fee_currency** | **string** | Fee currency unit. No value in public endpoints | [optional] -**point_fee** | **string** | Point used to deduct fee | [optional] -**gt_fee** | **string** | GT used to deduct fee | [optional] +**point_fee** | **string** | Points used to deduct fee. No value in public endpoints | [optional] +**gt_fee** | **string** | GT used to deduct fee. No value in public endpoints | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TradeFee.md b/docs/Model/TradeFee.md index b0a2c73..01ab8de 100644 --- a/docs/Model/TradeFee.md +++ b/docs/Model/TradeFee.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **user_id** | **int** | User ID | [optional] **taker_fee** | **string** | taker fee rate | [optional] **maker_fee** | **string** | maker fee rate | [optional] -**gt_discount** | **bool** | Is GT deduction is enabled | [optional] +**gt_discount** | **bool** | If GT deduction is enabled | [optional] **gt_taker_fee** | **string** | Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional] **gt_maker_fee** | **string** | Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional] **loan_fee** | **string** | Loan fee rate of margin lending | [optional] diff --git a/docs/Model/TransactionID.md b/docs/Model/TransactionID.md new file mode 100644 index 0000000..0bfd311 --- /dev/null +++ b/docs/Model/TransactionID.md @@ -0,0 +1,9 @@ +# # TransactionID + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_id** | **int** | Order id | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Transfer.md b/docs/Model/Transfer.md index 97c7b47..fe2a7b9 100644 --- a/docs/Model/Transfer.md +++ b/docs/Model/Transfer.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency** | **string** | Transfer currency. For futures account, `currency` can be set to `POINT` or settle currency | -**from** | **string** | Account transferred from | -**to** | **string** | Account transferred to | +**from** | **string** | Account to transfer from | +**to** | **string** | Account to transfer to | **amount** | **string** | Transfer amount | **currency_pair** | **string** | Margin currency pair. Required if transfer from or to margin account | [optional] -**settle** | **string** | Futures settle currency. Required if `currency` is `POINT` | [optional] +**settle** | **string** | Futures settle currency. Required if transferring from or to futures account | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TriggerTime.md b/docs/Model/TriggerTime.md new file mode 100644 index 0000000..268d84f --- /dev/null +++ b/docs/Model/TriggerTime.md @@ -0,0 +1,9 @@ +# # TriggerTime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**trigger_time** | **int** | Timestamp of the end of the countdown, in milliseconds | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WithdrawStatus.md b/docs/Model/WithdrawStatus.md index 67250f0..d9c2fd4 100644 --- a/docs/Model/WithdrawStatus.md +++ b/docs/Model/WithdrawStatus.md @@ -14,5 +14,6 @@ Name | Type | Description | Notes **withdraw_amount_mini** | **string** | Minimum withdrawal amount | [optional] **withdraw_day_limit_remain** | **string** | Daily withdrawal amount left | [optional] **withdraw_eachtime_limit** | **string** | Maximum amount for each withdrawal | [optional] +**withdraw_fix_on_chains** | **map[string,string]** | Fixed withdrawal fee on multiple chains | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/src/Api/DeliveryApi.php b/src/Api/DeliveryApi.php index d0a213f..ad2b5d2 100644 --- a/src/Api/DeliveryApi.php +++ b/src/Api/DeliveryApi.php @@ -618,7 +618,7 @@ protected function getDeliveryContractRequest($settle, $contract) * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -641,7 +641,7 @@ public function listDeliveryOrderBook($associative_array) * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -701,7 +701,7 @@ public function listDeliveryOrderBookWithHttpInfo($associative_array) * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -727,7 +727,7 @@ function ($response) { * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -780,7 +780,7 @@ function ($exception) { * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -951,8 +951,8 @@ protected function listDeliveryOrderBookRequest($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -975,8 +975,8 @@ public function listDeliveryTrades($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1036,8 +1036,8 @@ public function listDeliveryTradesWithHttpInfo($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1063,8 +1063,8 @@ function ($response) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1117,8 +1117,8 @@ function ($exception) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1306,8 +1306,8 @@ protected function listDeliveryTradesRequest($associative_array) * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1330,8 +1330,8 @@ public function listDeliveryCandlesticks($associative_array) * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1391,8 +1391,8 @@ public function listDeliveryCandlesticksWithHttpInfo($associative_array) * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1418,8 +1418,8 @@ function ($response) { * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1472,8 +1472,8 @@ function ($exception) { * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1921,7 +1921,7 @@ protected function listDeliveryTickersRequest($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1941,7 +1941,7 @@ public function listDeliveryInsuranceLedger($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1998,7 +1998,7 @@ public function listDeliveryInsuranceLedgerWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2021,7 +2021,7 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2071,7 +2071,7 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -2436,7 +2436,7 @@ protected function listDeliveryAccountsRequest($settle) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $from Start timestamp (optional) * @param int $to End timestamp (optional) * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) @@ -2459,7 +2459,7 @@ public function listDeliveryAccountBook($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $from Start timestamp (optional) * @param int $to End timestamp (optional) * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) @@ -2519,7 +2519,7 @@ public function listDeliveryAccountBookWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $from Start timestamp (optional) * @param int $to End timestamp (optional) * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) @@ -2545,7 +2545,7 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $from Start timestamp (optional) * @param int $to End timestamp (optional) * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) @@ -2598,7 +2598,7 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $from Start timestamp (optional) * @param int $to End timestamp (optional) * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) @@ -4117,9 +4117,9 @@ protected function updateDeliveryPositionRiskLimitRequest($settle, $contract, $r * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -4142,9 +4142,9 @@ public function listDeliveryOrders($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -4204,9 +4204,9 @@ public function listDeliveryOrdersWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -4232,9 +4232,9 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -4287,9 +4287,9 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -4748,7 +4748,7 @@ protected function createDeliveryOrderRequest($settle, $futures_order) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -4767,7 +4767,7 @@ public function cancelDeliveryOrders($settle, $contract, $side = null) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -4823,7 +4823,7 @@ public function cancelDeliveryOrdersWithHttpInfo($settle, $contract, $side = nul * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -4845,7 +4845,7 @@ function ($response) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -4894,7 +4894,7 @@ function ($exception) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -5027,7 +5027,7 @@ protected function cancelDeliveryOrdersRequest($settle, $contract, $side = null) * Get a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5045,7 +5045,7 @@ public function getDeliveryOrder($settle, $order_id) * Get a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5100,7 +5100,7 @@ public function getDeliveryOrderWithHttpInfo($settle, $order_id) * Get a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -5121,7 +5121,7 @@ function ($response) { * Get a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -5169,7 +5169,7 @@ function ($exception) { * Create request for operation 'getDeliveryOrder' * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -5287,7 +5287,7 @@ protected function getDeliveryOrderRequest($settle, $order_id) * Cancel a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5305,7 +5305,7 @@ public function cancelDeliveryOrder($settle, $order_id) * Cancel a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5360,7 +5360,7 @@ public function cancelDeliveryOrderWithHttpInfo($settle, $order_id) * Cancel a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -5381,7 +5381,7 @@ function ($response) { * Cancel a single order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -5429,7 +5429,7 @@ function ($exception) { * Create request for operation 'cancelDeliveryOrder' * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -5551,7 +5551,7 @@ protected function cancelDeliveryOrderRequest($settle, $order_id) * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -5576,7 +5576,7 @@ public function getMyDeliveryTrades($associative_array) * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -5638,7 +5638,7 @@ public function getMyDeliveryTradesWithHttpInfo($associative_array) * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -5666,7 +5666,7 @@ function ($response) { * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -5721,7 +5721,7 @@ function ($exception) { * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) @@ -5922,7 +5922,7 @@ protected function getMyDeliveryTradesRequest($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5943,7 +5943,7 @@ public function listDeliveryPositionClose($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -6001,7 +6001,7 @@ public function listDeliveryPositionCloseWithHttpInfo($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -6025,7 +6025,7 @@ function ($response) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -6076,7 +6076,7 @@ function ($exception) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -6218,7 +6218,7 @@ protected function listDeliveryPositionCloseRequest($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -6240,7 +6240,7 @@ public function listDeliveryLiquidates($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -6299,7 +6299,7 @@ public function listDeliveryLiquidatesWithHttpInfo($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \InvalidArgumentException @@ -6324,7 +6324,7 @@ function ($response) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \InvalidArgumentException @@ -6376,7 +6376,7 @@ function ($exception) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \InvalidArgumentException @@ -6532,7 +6532,7 @@ protected function listDeliveryLiquidatesRequest($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a settlement timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -6554,7 +6554,7 @@ public function listDeliverySettlements($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a settlement timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -6613,7 +6613,7 @@ public function listDeliverySettlementsWithHttpInfo($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a settlement timestamp (optional, default to 0) * * @throws \InvalidArgumentException @@ -6638,7 +6638,7 @@ function ($response) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a settlement timestamp (optional, default to 0) * * @throws \InvalidArgumentException @@ -6690,7 +6690,7 @@ function ($exception) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $at Specify a settlement timestamp (optional, default to 0) * * @throws \InvalidArgumentException @@ -6845,9 +6845,9 @@ protected function listDeliverySettlementsRequest($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -6868,9 +6868,9 @@ public function listPriceTriggeredDeliveryOrders($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -6928,9 +6928,9 @@ public function listPriceTriggeredDeliveryOrdersWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -6954,9 +6954,9 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -7007,9 +7007,9 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -7699,10 +7699,10 @@ protected function cancelPriceTriggeredDeliveryOrderListRequest($settle, $contra /** * Operation getPriceTriggeredDeliveryOrder * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -7717,10 +7717,10 @@ public function getPriceTriggeredDeliveryOrder($settle, $order_id) /** * Operation getPriceTriggeredDeliveryOrderWithHttpInfo * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -7772,10 +7772,10 @@ public function getPriceTriggeredDeliveryOrderWithHttpInfo($settle, $order_id) /** * Operation getPriceTriggeredDeliveryOrderAsync * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -7793,10 +7793,10 @@ function ($response) { /** * Operation getPriceTriggeredDeliveryOrderAsyncWithHttpInfo * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -7844,7 +7844,7 @@ function ($exception) { * Create request for operation 'getPriceTriggeredDeliveryOrder' * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -7959,10 +7959,10 @@ protected function getPriceTriggeredDeliveryOrderRequest($settle, $order_id) /** * Operation cancelPriceTriggeredDeliveryOrder * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -7977,10 +7977,10 @@ public function cancelPriceTriggeredDeliveryOrder($settle, $order_id) /** * Operation cancelPriceTriggeredDeliveryOrderWithHttpInfo * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -8032,10 +8032,10 @@ public function cancelPriceTriggeredDeliveryOrderWithHttpInfo($settle, $order_id /** * Operation cancelPriceTriggeredDeliveryOrderAsync * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -8053,10 +8053,10 @@ function ($response) { /** * Operation cancelPriceTriggeredDeliveryOrderAsyncWithHttpInfo * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -8104,7 +8104,7 @@ function ($exception) { * Create request for operation 'cancelPriceTriggeredDeliveryOrder' * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request diff --git a/src/Api/FlashSwapApi.php b/src/Api/FlashSwapApi.php new file mode 100644 index 0000000..ad2e3f9 --- /dev/null +++ b/src/Api/FlashSwapApi.php @@ -0,0 +1,1405 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $host_index; + } + + /** + * Set the host index + * + * @param int Host index (required) + */ + public function setHostIndex($host_index) + { + $this->hostIndex = $host_index; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation listFlashSwapCurrencies + * + * List all supported currencies in flash swap + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FlashSwapCurrency[] + */ + public function listFlashSwapCurrencies() + { + list($response) = $this->listFlashSwapCurrenciesWithHttpInfo(); + return $response; + } + + /** + * Operation listFlashSwapCurrenciesWithHttpInfo + * + * List all supported currencies in flash swap + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FlashSwapCurrency[], HTTP status code, HTTP response headers (array of strings) + */ + public function listFlashSwapCurrenciesWithHttpInfo() + { + $request = $this->listFlashSwapCurrenciesRequest(); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FlashSwapCurrency[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listFlashSwapCurrenciesAsync + * + * List all supported currencies in flash swap + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listFlashSwapCurrenciesAsync() + { + return $this->listFlashSwapCurrenciesAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listFlashSwapCurrenciesAsyncWithHttpInfo + * + * List all supported currencies in flash swap + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listFlashSwapCurrenciesAsyncWithHttpInfo() + { + $returnType = '\GateApi\Model\FlashSwapCurrency[]'; + $request = $this->listFlashSwapCurrenciesRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listFlashSwapCurrencies' + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listFlashSwapCurrenciesRequest() + { + + $resourcePath = '/flash_swap/currencies'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listFlashSwapOrders + * + * List all flash swap orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Flash swap order status `1` - success `2` - failure (optional) + * @param string $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param string $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param bool $reverse If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FlashSwapOrder[] + */ + public function listFlashSwapOrders($associative_array) + { + list($response) = $this->listFlashSwapOrdersWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listFlashSwapOrdersWithHttpInfo + * + * List all flash swap orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Flash swap order status `1` - success `2` - failure (optional) + * @param string $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param string $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param bool $reverse If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FlashSwapOrder[], HTTP status code, HTTP response headers (array of strings) + */ + public function listFlashSwapOrdersWithHttpInfo($associative_array) + { + $request = $this->listFlashSwapOrdersRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FlashSwapOrder[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listFlashSwapOrdersAsync + * + * List all flash swap orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Flash swap order status `1` - success `2` - failure (optional) + * @param string $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param string $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param bool $reverse If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listFlashSwapOrdersAsync($associative_array) + { + return $this->listFlashSwapOrdersAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listFlashSwapOrdersAsyncWithHttpInfo + * + * List all flash swap orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Flash swap order status `1` - success `2` - failure (optional) + * @param string $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param string $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param bool $reverse If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listFlashSwapOrdersAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\FlashSwapOrder[]'; + $request = $this->listFlashSwapOrdersRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listFlashSwapOrders' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Flash swap order status `1` - success `2` - failure (optional) + * @param string $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param string $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` (optional) + * @param bool $reverse If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listFlashSwapOrdersRequest($associative_array) + { + // unbox the parameters from the associative array + $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; + $sell_currency = array_key_exists('sell_currency', $associative_array) ? $associative_array['sell_currency'] : null; + $buy_currency = array_key_exists('buy_currency', $associative_array) ? $associative_array['buy_currency'] : null; + $reverse = array_key_exists('reverse', $associative_array) ? $associative_array['reverse'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FlashSwapApi.listFlashSwapOrders, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FlashSwapApi.listFlashSwapOrders, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling FlashSwapApi.listFlashSwapOrders, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/flash_swap/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($status !== null) { + if('form' === 'form' && is_array($status)) { + foreach($status as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['status'] = $status; + } + } + + // query params + if ($sell_currency !== null) { + if('form' === 'form' && is_array($sell_currency)) { + foreach($sell_currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['sell_currency'] = $sell_currency; + } + } + + // query params + if ($buy_currency !== null) { + if('form' === 'form' && is_array($buy_currency)) { + foreach($buy_currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['buy_currency'] = $buy_currency; + } + } + + // query params + if ($reverse !== null) { + if('form' === 'form' && is_array($reverse)) { + foreach($reverse as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['reverse'] = $reverse; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($page !== null) { + if('form' === 'form' && is_array($page)) { + foreach($page as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['page'] = $page; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createFlashSwapOrder + * + * Create a flash swap order + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request flash_swap_order_request (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FlashSwapOrder + */ + public function createFlashSwapOrder($flash_swap_order_request) + { + list($response) = $this->createFlashSwapOrderWithHttpInfo($flash_swap_order_request); + return $response; + } + + /** + * Operation createFlashSwapOrderWithHttpInfo + * + * Create a flash swap order + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FlashSwapOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function createFlashSwapOrderWithHttpInfo($flash_swap_order_request) + { + $request = $this->createFlashSwapOrderRequest($flash_swap_order_request); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FlashSwapOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation createFlashSwapOrderAsync + * + * Create a flash swap order + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFlashSwapOrderAsync($flash_swap_order_request) + { + return $this->createFlashSwapOrderAsyncWithHttpInfo($flash_swap_order_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createFlashSwapOrderAsyncWithHttpInfo + * + * Create a flash swap order + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFlashSwapOrderAsyncWithHttpInfo($flash_swap_order_request) + { + $returnType = '\GateApi\Model\FlashSwapOrder'; + $request = $this->createFlashSwapOrderRequest($flash_swap_order_request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createFlashSwapOrder' + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createFlashSwapOrderRequest($flash_swap_order_request) + { + // verify the required parameter 'flash_swap_order_request' is set + if ($flash_swap_order_request === null || (is_array($flash_swap_order_request) && count($flash_swap_order_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $flash_swap_order_request when calling createFlashSwapOrder' + ); + } + + $resourcePath = '/flash_swap/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($flash_swap_order_request)) { + $_tempBody = $flash_swap_order_request; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getFlashSwapOrder + * + * Get a single flash swap order's detail + * + * @param int $order_id Flash swap order ID (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FlashSwapOrder + */ + public function getFlashSwapOrder($order_id) + { + list($response) = $this->getFlashSwapOrderWithHttpInfo($order_id); + return $response; + } + + /** + * Operation getFlashSwapOrderWithHttpInfo + * + * Get a single flash swap order's detail + * + * @param int $order_id Flash swap order ID (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FlashSwapOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function getFlashSwapOrderWithHttpInfo($order_id) + { + $request = $this->getFlashSwapOrderRequest($order_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FlashSwapOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getFlashSwapOrderAsync + * + * Get a single flash swap order's detail + * + * @param int $order_id Flash swap order ID (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFlashSwapOrderAsync($order_id) + { + return $this->getFlashSwapOrderAsyncWithHttpInfo($order_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFlashSwapOrderAsyncWithHttpInfo + * + * Get a single flash swap order's detail + * + * @param int $order_id Flash swap order ID (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFlashSwapOrderAsyncWithHttpInfo($order_id) + { + $returnType = '\GateApi\Model\FlashSwapOrder'; + $request = $this->getFlashSwapOrderRequest($order_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getFlashSwapOrder' + * + * @param int $order_id Flash swap order ID (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFlashSwapOrderRequest($order_id) + { + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling getFlashSwapOrder' + ); + } + + $resourcePath = '/flash_swap/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation previewFlashSwapOrder + * + * Initiate a flash swap order preview + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request flash_swap_order_request (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FlashSwapOrderPreview + */ + public function previewFlashSwapOrder($flash_swap_order_request) + { + list($response) = $this->previewFlashSwapOrderWithHttpInfo($flash_swap_order_request); + return $response; + } + + /** + * Operation previewFlashSwapOrderWithHttpInfo + * + * Initiate a flash swap order preview + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FlashSwapOrderPreview, HTTP status code, HTTP response headers (array of strings) + */ + public function previewFlashSwapOrderWithHttpInfo($flash_swap_order_request) + { + $request = $this->previewFlashSwapOrderRequest($flash_swap_order_request); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FlashSwapOrderPreview'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation previewFlashSwapOrderAsync + * + * Initiate a flash swap order preview + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function previewFlashSwapOrderAsync($flash_swap_order_request) + { + return $this->previewFlashSwapOrderAsyncWithHttpInfo($flash_swap_order_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation previewFlashSwapOrderAsyncWithHttpInfo + * + * Initiate a flash swap order preview + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function previewFlashSwapOrderAsyncWithHttpInfo($flash_swap_order_request) + { + $returnType = '\GateApi\Model\FlashSwapOrderPreview'; + $request = $this->previewFlashSwapOrderRequest($flash_swap_order_request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'previewFlashSwapOrder' + * + * @param \GateApi\Model\FlashSwapOrderRequest $flash_swap_order_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function previewFlashSwapOrderRequest($flash_swap_order_request) + { + // verify the required parameter 'flash_swap_order_request' is set + if ($flash_swap_order_request === null || (is_array($flash_swap_order_request) && count($flash_swap_order_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $flash_swap_order_request when calling previewFlashSwapOrder' + ); + } + + $resourcePath = '/flash_swap/orders/preview'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($flash_swap_order_request)) { + $_tempBody = $flash_swap_order_request; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Api/FuturesApi.php b/src/Api/FuturesApi.php index f06c361..5350314 100644 --- a/src/Api/FuturesApi.php +++ b/src/Api/FuturesApi.php @@ -618,7 +618,7 @@ protected function getFuturesContractRequest($settle, $contract) * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -641,7 +641,7 @@ public function listFuturesOrderBook($associative_array) * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -701,7 +701,7 @@ public function listFuturesOrderBookWithHttpInfo($associative_array) * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -727,7 +727,7 @@ function ($response) { * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -780,7 +780,7 @@ function ($exception) { * @param string $contract Futures contract (required) * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) - * @param bool $with_id Whether order book update ID would be returned. This ID increments by 1 on every order book update (optional, default to false) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -951,8 +951,9 @@ protected function listFuturesOrderBookRequest($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -975,8 +976,9 @@ public function listFuturesTrades($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1036,8 +1038,9 @@ public function listFuturesTradesWithHttpInfo($associative_array) * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1063,8 +1066,9 @@ function ($response) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1117,8 +1121,9 @@ function ($exception) { * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param string $last_id Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) * @param int $from Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) * @param int $to Specify end time in Unix seconds, default to current time (optional) * @@ -1131,6 +1136,7 @@ protected function listFuturesTradesRequest($associative_array) $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; $last_id = array_key_exists('last_id', $associative_array) ? $associative_array['last_id'] : null; $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; @@ -1154,6 +1160,10 @@ protected function listFuturesTradesRequest($associative_array) throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesTrades, must be bigger than or equal to 1.'); } + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.listFuturesTrades, must be bigger than or equal to 0.'); + } + $resourcePath = '/futures/{settle}/trades'; $formParams = []; @@ -1186,6 +1196,18 @@ protected function listFuturesTradesRequest($associative_array) } } + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + // query params if ($last_id !== null) { if('form' === 'form' && is_array($last_id)) { @@ -1306,8 +1328,8 @@ protected function listFuturesTradesRequest($associative_array) * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1330,8 +1352,8 @@ public function listFuturesCandlesticks($associative_array) * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1391,8 +1413,8 @@ public function listFuturesCandlesticksWithHttpInfo($associative_array) * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1418,8 +1440,8 @@ function ($response) { * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1472,8 +1494,8 @@ function ($exception) { * @param string $contract Futures contract (required) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) - * @param string $interval Interval time between data points (optional, default to '5m') + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1646,42 +1668,50 @@ protected function listFuturesCandlesticksRequest($associative_array) } /** - * Operation listFuturesTickers + * Operation listFuturesPremiumIndex * - * List futures tickers + * Premium Index K-Line * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) + * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) + * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points (optional, default to '5m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesTicker[] + * @return \GateApi\Model\FuturesPremiumIndex[] */ - public function listFuturesTickers($associative_array) + public function listFuturesPremiumIndex($associative_array) { - list($response) = $this->listFuturesTickersWithHttpInfo($associative_array); + list($response) = $this->listFuturesPremiumIndexWithHttpInfo($associative_array); return $response; } /** - * Operation listFuturesTickersWithHttpInfo + * Operation listFuturesPremiumIndexWithHttpInfo * - * List futures tickers + * Premium Index K-Line * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) + * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) + * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points (optional, default to '5m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesTicker[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesPremiumIndex[], HTTP status code, HTTP response headers (array of strings) */ - public function listFuturesTickersWithHttpInfo($associative_array) + public function listFuturesPremiumIndexWithHttpInfo($associative_array) { - $request = $this->listFuturesTickersRequest($associative_array); + $request = $this->listFuturesPremiumIndexRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -1707,7 +1737,7 @@ public function listFuturesTickersWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\FuturesTicker[]'; + $returnType = '\GateApi\Model\FuturesPremiumIndex[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -1723,21 +1753,25 @@ public function listFuturesTickersWithHttpInfo($associative_array) } /** - * Operation listFuturesTickersAsync + * Operation listFuturesPremiumIndexAsync * - * List futures tickers + * Premium Index K-Line * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) + * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) + * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesTickersAsync($associative_array) + public function listFuturesPremiumIndexAsync($associative_array) { - return $this->listFuturesTickersAsyncWithHttpInfo($associative_array) + return $this->listFuturesPremiumIndexAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -1746,22 +1780,26 @@ function ($response) { } /** - * Operation listFuturesTickersAsyncWithHttpInfo + * Operation listFuturesPremiumIndexAsyncWithHttpInfo * - * List futures tickers + * Premium Index K-Line * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) + * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) + * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesTickersAsyncWithHttpInfo($associative_array) + public function listFuturesPremiumIndexAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\FuturesTicker[]'; - $request = $this->listFuturesTickersRequest($associative_array); + $returnType = '\GateApi\Model\FuturesPremiumIndex[]'; + $request = $this->listFuturesPremiumIndexRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1798,30 +1836,48 @@ function ($exception) { } /** - * Create request for operation 'listFuturesTickers' + * Create request for operation 'listFuturesPremiumIndex' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) + * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) + * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param string $interval Interval time between data points (optional, default to '5m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listFuturesTickersRequest($associative_array) + protected function listFuturesPremiumIndexRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $interval = array_key_exists('interval', $associative_array) ? $associative_array['interval'] : '5m'; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listFuturesTickers' + 'Missing the required parameter $settle when calling listFuturesPremiumIndex' + ); + } + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling listFuturesPremiumIndex' ); } + if ($limit !== null && $limit > 2000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesPremiumIndex, must be smaller than or equal to 2000.'); + } - $resourcePath = '/futures/{settle}/tickers'; + + $resourcePath = '/futures/{settle}/premium_index'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1840,6 +1896,54 @@ protected function listFuturesTickersRequest($associative_array) } } + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($interval !== null) { + if('form' === 'form' && is_array($interval)) { + foreach($interval as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['interval'] = $interval; + } + } + // path params if ($settle !== null) { $resourcePath = str_replace( @@ -1914,44 +2018,42 @@ protected function listFuturesTickersRequest($associative_array) } /** - * Operation listFuturesFundingRateHistory + * Operation listFuturesTickers * - * Funding rate history + * List futures tickers * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $contract Futures contract, return related data only if specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FundingRateRecord[] + * @return \GateApi\Model\FuturesTicker[] */ - public function listFuturesFundingRateHistory($associative_array) + public function listFuturesTickers($associative_array) { - list($response) = $this->listFuturesFundingRateHistoryWithHttpInfo($associative_array); + list($response) = $this->listFuturesTickersWithHttpInfo($associative_array); return $response; } /** - * Operation listFuturesFundingRateHistoryWithHttpInfo + * Operation listFuturesTickersWithHttpInfo * - * Funding rate history + * List futures tickers * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $contract Futures contract, return related data only if specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FundingRateRecord[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesTicker[], HTTP status code, HTTP response headers (array of strings) */ - public function listFuturesFundingRateHistoryWithHttpInfo($associative_array) + public function listFuturesTickersWithHttpInfo($associative_array) { - $request = $this->listFuturesFundingRateHistoryRequest($associative_array); + $request = $this->listFuturesTickersRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -1977,7 +2079,7 @@ public function listFuturesFundingRateHistoryWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\FundingRateRecord[]'; + $returnType = '\GateApi\Model\FuturesTicker[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -1993,22 +2095,21 @@ public function listFuturesFundingRateHistoryWithHttpInfo($associative_array) } /** - * Operation listFuturesFundingRateHistoryAsync + * Operation listFuturesTickersAsync * - * Funding rate history + * List futures tickers * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $contract Futures contract, return related data only if specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesFundingRateHistoryAsync($associative_array) + public function listFuturesTickersAsync($associative_array) { - return $this->listFuturesFundingRateHistoryAsyncWithHttpInfo($associative_array) + return $this->listFuturesTickersAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -2017,23 +2118,22 @@ function ($response) { } /** - * Operation listFuturesFundingRateHistoryAsyncWithHttpInfo + * Operation listFuturesTickersAsyncWithHttpInfo * - * Funding rate history + * List futures tickers * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $contract Futures contract, return related data only if specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesFundingRateHistoryAsyncWithHttpInfo($associative_array) + public function listFuturesTickersAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\FundingRateRecord[]'; - $request = $this->listFuturesFundingRateHistoryRequest($associative_array); + $returnType = '\GateApi\Model\FuturesTicker[]'; + $request = $this->listFuturesTickersRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2070,45 +2170,30 @@ function ($exception) { } /** - * Create request for operation 'listFuturesFundingRateHistory' + * Create request for operation 'listFuturesTickers' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $contract Futures contract, return related data only if specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listFuturesFundingRateHistoryRequest($associative_array) + protected function listFuturesTickersRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listFuturesFundingRateHistory' - ); - } - // verify the required parameter 'contract' is set - if ($contract === null || (is_array($contract) && count($contract) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling listFuturesFundingRateHistory' + 'Missing the required parameter $settle when calling listFuturesTickers' ); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesFundingRateHistory, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesFundingRateHistory, must be bigger than or equal to 1.'); - } - - $resourcePath = '/futures/{settle}/funding_rate'; + $resourcePath = '/futures/{settle}/tickers'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2127,18 +2212,6 @@ protected function listFuturesFundingRateHistoryRequest($associative_array) } } - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - // path params if ($settle !== null) { $resourcePath = str_replace( @@ -2213,42 +2286,44 @@ protected function listFuturesFundingRateHistoryRequest($associative_array) } /** - * Operation listFuturesInsuranceLedger + * Operation listFuturesFundingRateHistory * - * Futures insurance balance history + * Funding rate history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\InsuranceRecord[] + * @return \GateApi\Model\FundingRateRecord[] */ - public function listFuturesInsuranceLedger($associative_array) + public function listFuturesFundingRateHistory($associative_array) { - list($response) = $this->listFuturesInsuranceLedgerWithHttpInfo($associative_array); + list($response) = $this->listFuturesFundingRateHistoryWithHttpInfo($associative_array); return $response; } /** - * Operation listFuturesInsuranceLedgerWithHttpInfo + * Operation listFuturesFundingRateHistoryWithHttpInfo * - * Futures insurance balance history + * Funding rate history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\InsuranceRecord[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FundingRateRecord[], HTTP status code, HTTP response headers (array of strings) */ - public function listFuturesInsuranceLedgerWithHttpInfo($associative_array) + public function listFuturesFundingRateHistoryWithHttpInfo($associative_array) { - $request = $this->listFuturesInsuranceLedgerRequest($associative_array); + $request = $this->listFuturesFundingRateHistoryRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -2274,7 +2349,7 @@ public function listFuturesInsuranceLedgerWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\InsuranceRecord[]'; + $returnType = '\GateApi\Model\FundingRateRecord[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -2290,21 +2365,22 @@ public function listFuturesInsuranceLedgerWithHttpInfo($associative_array) } /** - * Operation listFuturesInsuranceLedgerAsync + * Operation listFuturesFundingRateHistoryAsync * - * Futures insurance balance history + * Funding rate history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesInsuranceLedgerAsync($associative_array) + public function listFuturesFundingRateHistoryAsync($associative_array) { - return $this->listFuturesInsuranceLedgerAsyncWithHttpInfo($associative_array) + return $this->listFuturesFundingRateHistoryAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -2313,22 +2389,23 @@ function ($response) { } /** - * Operation listFuturesInsuranceLedgerAsyncWithHttpInfo + * Operation listFuturesFundingRateHistoryAsyncWithHttpInfo * - * Futures insurance balance history + * Funding rate history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesInsuranceLedgerAsyncWithHttpInfo($associative_array) + public function listFuturesFundingRateHistoryAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\InsuranceRecord[]'; - $request = $this->listFuturesInsuranceLedgerRequest($associative_array); + $returnType = '\GateApi\Model\FundingRateRecord[]'; + $request = $this->listFuturesFundingRateHistoryRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2365,43 +2442,63 @@ function ($exception) { } /** - * Create request for operation 'listFuturesInsuranceLedger' + * Create request for operation 'listFuturesFundingRateHistory' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listFuturesInsuranceLedgerRequest($associative_array) + protected function listFuturesFundingRateHistoryRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listFuturesInsuranceLedger' + 'Missing the required parameter $settle when calling listFuturesFundingRateHistory' + ); + } + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling listFuturesFundingRateHistory' ); } if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesInsuranceLedger, must be smaller than or equal to 1000.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesFundingRateHistory, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesInsuranceLedger, must be bigger than or equal to 1.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesFundingRateHistory, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/insurance'; + $resourcePath = '/futures/{settle}/funding_rate'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + // query params if ($limit !== null) { if('form' === 'form' && is_array($limit)) { @@ -2488,48 +2585,42 @@ protected function listFuturesInsuranceLedgerRequest($associative_array) } /** - * Operation listContractStats + * Operation listFuturesInsuranceLedger * - * Futures stats + * Futures insurance balance history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $from Start timestamp (optional) - * @param string $interval interval (optional, default to '5m') - * @param int $limit limit (optional, default to 30) + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\ContractStat[] + * @return \GateApi\Model\InsuranceRecord[] */ - public function listContractStats($associative_array) + public function listFuturesInsuranceLedger($associative_array) { - list($response) = $this->listContractStatsWithHttpInfo($associative_array); + list($response) = $this->listFuturesInsuranceLedgerWithHttpInfo($associative_array); return $response; } /** - * Operation listContractStatsWithHttpInfo + * Operation listFuturesInsuranceLedgerWithHttpInfo * - * Futures stats + * Futures insurance balance history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $from Start timestamp (optional) - * @param string $interval (optional, default to '5m') - * @param int $limit (optional, default to 30) + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\ContractStat[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\InsuranceRecord[], HTTP status code, HTTP response headers (array of strings) */ - public function listContractStatsWithHttpInfo($associative_array) + public function listFuturesInsuranceLedgerWithHttpInfo($associative_array) { - $request = $this->listContractStatsRequest($associative_array); + $request = $this->listFuturesInsuranceLedgerRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -2555,7 +2646,7 @@ public function listContractStatsWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\ContractStat[]'; + $returnType = '\GateApi\Model\InsuranceRecord[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -2571,24 +2662,21 @@ public function listContractStatsWithHttpInfo($associative_array) } /** - * Operation listContractStatsAsync + * Operation listFuturesInsuranceLedgerAsync * - * Futures stats + * Futures insurance balance history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $from Start timestamp (optional) - * @param string $interval (optional, default to '5m') - * @param int $limit (optional, default to 30) + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listContractStatsAsync($associative_array) + public function listFuturesInsuranceLedgerAsync($associative_array) { - return $this->listContractStatsAsyncWithHttpInfo($associative_array) + return $this->listFuturesInsuranceLedgerAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -2597,25 +2685,22 @@ function ($response) { } /** - * Operation listContractStatsAsyncWithHttpInfo + * Operation listFuturesInsuranceLedgerAsyncWithHttpInfo * - * Futures stats + * Futures insurance balance history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $from Start timestamp (optional) - * @param string $interval (optional, default to '5m') - * @param int $limit (optional, default to 30) + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listContractStatsAsyncWithHttpInfo($associative_array) + public function listFuturesInsuranceLedgerAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\ContractStat[]'; - $request = $this->listContractStatsRequest($associative_array); + $returnType = '\GateApi\Model\InsuranceRecord[]'; + $request = $this->listFuturesInsuranceLedgerRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2652,91 +2737,43 @@ function ($exception) { } /** - * Create request for operation 'listContractStats' + * Create request for operation 'listFuturesInsuranceLedger' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param int $from Start timestamp (optional) - * @param string $interval (optional, default to '5m') - * @param int $limit (optional, default to 30) + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listContractStatsRequest($associative_array) + protected function listFuturesInsuranceLedgerRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; - $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; - $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; - $interval = array_key_exists('interval', $associative_array) ? $associative_array['interval'] : '5m'; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 30; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listContractStats' - ); - } - // verify the required parameter 'contract' is set - if ($contract === null || (is_array($contract) && count($contract) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling listContractStats' + 'Missing the required parameter $settle when calling listFuturesInsuranceLedger' ); } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listContractStats, must be smaller than or equal to 100.'); + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesInsuranceLedger, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listContractStats, must be bigger than or equal to 1.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesInsuranceLedger, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/contract_stats'; + $resourcePath = '/futures/{settle}/insurance'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($contract !== null) { - if('form' === 'form' && is_array($contract)) { - foreach($contract as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['contract'] = $contract; - } - } - - // query params - if ($from !== null) { - if('form' === 'form' && is_array($from)) { - foreach($from as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['from'] = $from; - } - } - - // query params - if ($interval !== null) { - if('form' === 'form' && is_array($interval)) { - foreach($interval as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['interval'] = $interval; - } - } - // query params if ($limit !== null) { if('form' === 'form' && is_array($limit)) { @@ -2823,48 +2860,48 @@ protected function listContractStatsRequest($associative_array) } /** - * Operation listLiquidatedOrders + * Operation listContractStats * - * Retrieve liquidation history + * Futures stats * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $interval interval (optional, default to '5m') + * @param int $limit limit (optional, default to 30) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesLiquidate[] + * @return \GateApi\Model\ContractStat[] */ - public function listLiquidatedOrders($associative_array) + public function listContractStats($associative_array) { - list($response) = $this->listLiquidatedOrdersWithHttpInfo($associative_array); + list($response) = $this->listContractStatsWithHttpInfo($associative_array); return $response; } /** - * Operation listLiquidatedOrdersWithHttpInfo + * Operation listContractStatsWithHttpInfo * - * Retrieve liquidation history + * Futures stats * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $interval (optional, default to '5m') + * @param int $limit (optional, default to 30) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesLiquidate[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\ContractStat[], HTTP status code, HTTP response headers (array of strings) */ - public function listLiquidatedOrdersWithHttpInfo($associative_array) + public function listContractStatsWithHttpInfo($associative_array) { - $request = $this->listLiquidatedOrdersRequest($associative_array); + $request = $this->listContractStatsRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -2890,7 +2927,7 @@ public function listLiquidatedOrdersWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\FuturesLiquidate[]'; + $returnType = '\GateApi\Model\ContractStat[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -2906,24 +2943,24 @@ public function listLiquidatedOrdersWithHttpInfo($associative_array) } /** - * Operation listLiquidatedOrdersAsync + * Operation listContractStatsAsync * - * Retrieve liquidation history + * Futures stats * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $interval (optional, default to '5m') + * @param int $limit (optional, default to 30) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listLiquidatedOrdersAsync($associative_array) + public function listContractStatsAsync($associative_array) { - return $this->listLiquidatedOrdersAsyncWithHttpInfo($associative_array) + return $this->listContractStatsAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -2932,25 +2969,25 @@ function ($response) { } /** - * Operation listLiquidatedOrdersAsyncWithHttpInfo + * Operation listContractStatsAsyncWithHttpInfo * - * Retrieve liquidation history + * Futures stats * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $interval (optional, default to '5m') + * @param int $limit (optional, default to 30) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listLiquidatedOrdersAsyncWithHttpInfo($associative_array) + public function listContractStatsAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\FuturesLiquidate[]'; - $request = $this->listLiquidatedOrdersRequest($associative_array); + $returnType = '\GateApi\Model\ContractStat[]'; + $request = $this->listContractStatsRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2987,43 +3024,49 @@ function ($exception) { } /** - * Create request for operation 'listLiquidatedOrders' + * Create request for operation 'listContractStats' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) + * @param string $contract Futures contract (required) * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $interval (optional, default to '5m') + * @param int $limit (optional, default to 30) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listLiquidatedOrdersRequest($associative_array) + protected function listContractStatsRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; - $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $interval = array_key_exists('interval', $associative_array) ? $associative_array['interval'] : '5m'; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 30; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listLiquidatedOrders' + 'Missing the required parameter $settle when calling listContractStats' ); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidatedOrders, must be smaller than or equal to 1000.'); + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling listContractStats' + ); + } + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listContractStats, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidatedOrders, must be bigger than or equal to 1.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listContractStats, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/liq_orders'; + $resourcePath = '/futures/{settle}/contract_stats'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3055,14 +3098,14 @@ protected function listLiquidatedOrdersRequest($associative_array) } // query params - if ($to !== null) { - if('form' === 'form' && is_array($to)) { - foreach($to as $key => $value) { + if ($interval !== null) { + if('form' === 'form' && is_array($interval)) { + foreach($interval as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['to'] = $to; + $queryParams['interval'] = $interval; } } @@ -3152,36 +3195,38 @@ protected function listLiquidatedOrdersRequest($associative_array) } /** - * Operation listFuturesAccounts + * Operation getIndexConstituents * - * Query futures account + * Get index constituents * * @param string $settle Settle currency (required) + * @param string $index Index name (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesAccount + * @return \GateApi\Model\FuturesIndexConstituents */ - public function listFuturesAccounts($settle) + public function getIndexConstituents($settle, $index) { - list($response) = $this->listFuturesAccountsWithHttpInfo($settle); + list($response) = $this->getIndexConstituentsWithHttpInfo($settle, $index); return $response; } /** - * Operation listFuturesAccountsWithHttpInfo + * Operation getIndexConstituentsWithHttpInfo * - * Query futures account + * Get index constituents * * @param string $settle Settle currency (required) + * @param string $index Index name (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesAccount, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesIndexConstituents, HTTP status code, HTTP response headers (array of strings) */ - public function listFuturesAccountsWithHttpInfo($settle) + public function getIndexConstituentsWithHttpInfo($settle, $index) { - $request = $this->listFuturesAccountsRequest($settle); + $request = $this->getIndexConstituentsRequest($settle, $index); $options = $this->createHttpClientOption(); try { @@ -3207,7 +3252,7 @@ public function listFuturesAccountsWithHttpInfo($settle) ); } - $returnType = '\GateApi\Model\FuturesAccount'; + $returnType = '\GateApi\Model\FuturesIndexConstituents'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -3223,18 +3268,19 @@ public function listFuturesAccountsWithHttpInfo($settle) } /** - * Operation listFuturesAccountsAsync + * Operation getIndexConstituentsAsync * - * Query futures account + * Get index constituents * * @param string $settle Settle currency (required) + * @param string $index Index name (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesAccountsAsync($settle) + public function getIndexConstituentsAsync($settle, $index) { - return $this->listFuturesAccountsAsyncWithHttpInfo($settle) + return $this->getIndexConstituentsAsyncWithHttpInfo($settle, $index) ->then( function ($response) { return $response[0]; @@ -3243,19 +3289,20 @@ function ($response) { } /** - * Operation listFuturesAccountsAsyncWithHttpInfo + * Operation getIndexConstituentsAsyncWithHttpInfo * - * Query futures account + * Get index constituents * * @param string $settle Settle currency (required) + * @param string $index Index name (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesAccountsAsyncWithHttpInfo($settle) + public function getIndexConstituentsAsyncWithHttpInfo($settle, $index) { - $returnType = '\GateApi\Model\FuturesAccount'; - $request = $this->listFuturesAccountsRequest($settle); + $returnType = '\GateApi\Model\FuturesIndexConstituents'; + $request = $this->getIndexConstituentsRequest($settle, $index); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3292,23 +3339,30 @@ function ($exception) { } /** - * Create request for operation 'listFuturesAccounts' + * Create request for operation 'getIndexConstituents' * * @param string $settle Settle currency (required) + * @param string $index Index name (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listFuturesAccountsRequest($settle) + protected function getIndexConstituentsRequest($settle, $index) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listFuturesAccounts' + 'Missing the required parameter $settle when calling getIndexConstituents' + ); + } + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getIndexConstituents' ); } - $resourcePath = '/futures/{settle}/accounts'; + $resourcePath = '/futures/{settle}/index_constituents/{index}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3324,6 +3378,15 @@ protected function listFuturesAccountsRequest($settle) ); } + // path params + if ($index !== null) { + $resourcePath = str_replace( + '{' . 'index' . '}', + ObjectSerializer::toPathValue($index), + $resourcePath + ); + } + // body params $_tempBody = null; @@ -3367,9 +3430,6 @@ protected function listFuturesAccountsRequest($settle) } } - // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); - $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -3392,48 +3452,48 @@ protected function listFuturesAccountsRequest($settle) } /** - * Operation listFuturesAccountBook + * Operation listLiquidatedOrders * - * Query account book + * Retrieve liquidation history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesAccountBook[] + * @return \GateApi\Model\FuturesLiquidate[] */ - public function listFuturesAccountBook($associative_array) + public function listLiquidatedOrders($associative_array) { - list($response) = $this->listFuturesAccountBookWithHttpInfo($associative_array); + list($response) = $this->listLiquidatedOrdersWithHttpInfo($associative_array); return $response; } /** - * Operation listFuturesAccountBookWithHttpInfo + * Operation listLiquidatedOrdersWithHttpInfo * - * Query account book + * Retrieve liquidation history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesAccountBook[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesLiquidate[], HTTP status code, HTTP response headers (array of strings) */ - public function listFuturesAccountBookWithHttpInfo($associative_array) + public function listLiquidatedOrdersWithHttpInfo($associative_array) { - $request = $this->listFuturesAccountBookRequest($associative_array); + $request = $this->listLiquidatedOrdersRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -3459,7 +3519,7 @@ public function listFuturesAccountBookWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\FuturesAccountBook[]'; + $returnType = '\GateApi\Model\FuturesLiquidate[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -3475,24 +3535,24 @@ public function listFuturesAccountBookWithHttpInfo($associative_array) } /** - * Operation listFuturesAccountBookAsync + * Operation listLiquidatedOrdersAsync * - * Query account book + * Retrieve liquidation history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesAccountBookAsync($associative_array) + public function listLiquidatedOrdersAsync($associative_array) { - return $this->listFuturesAccountBookAsyncWithHttpInfo($associative_array) + return $this->listLiquidatedOrdersAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -3501,25 +3561,25 @@ function ($response) { } /** - * Operation listFuturesAccountBookAsyncWithHttpInfo + * Operation listLiquidatedOrdersAsyncWithHttpInfo * - * Query account book + * Retrieve liquidation history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesAccountBookAsyncWithHttpInfo($associative_array) + public function listLiquidatedOrdersAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\FuturesAccountBook[]'; - $request = $this->listFuturesAccountBookRequest($associative_array); + $returnType = '\GateApi\Model\FuturesLiquidate[]'; + $request = $this->listLiquidatedOrdersRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3556,43 +3616,43 @@ function ($exception) { } /** - * Create request for operation 'listFuturesAccountBook' + * Create request for operation 'listLiquidatedOrders' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $from Start timestamp (optional) - * @param int $to End timestamp (optional) - * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listFuturesAccountBookRequest($associative_array) + protected function listLiquidatedOrdersRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; - $type = array_key_exists('type', $associative_array) ? $associative_array['type'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listFuturesAccountBook' + 'Missing the required parameter $settle when calling listLiquidatedOrders' ); } if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesAccountBook, must be smaller than or equal to 1000.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidatedOrders, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesAccountBook, must be bigger than or equal to 1.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidatedOrders, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/account_book'; + $resourcePath = '/futures/{settle}/liq_orders'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3600,14 +3660,14 @@ protected function listFuturesAccountBookRequest($associative_array) $multipart = false; // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['limit'] = $limit; + $queryParams['contract'] = $contract; } } @@ -3636,14 +3696,14 @@ protected function listFuturesAccountBookRequest($associative_array) } // query params - if ($type !== null) { - if('form' === 'form' && is_array($type)) { - foreach($type as $key => $value) { + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['type'] = $type; + $queryParams['limit'] = $limit; } } @@ -3699,9 +3759,6 @@ protected function listFuturesAccountBookRequest($associative_array) } } - // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); - $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -3724,36 +3781,36 @@ protected function listFuturesAccountBookRequest($associative_array) } /** - * Operation listPositions + * Operation listFuturesAccounts * - * List all positions of a user + * Query futures account * * @param string $settle Settle currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Position[] + * @return \GateApi\Model\FuturesAccount */ - public function listPositions($settle) + public function listFuturesAccounts($settle) { - list($response) = $this->listPositionsWithHttpInfo($settle); + list($response) = $this->listFuturesAccountsWithHttpInfo($settle); return $response; } /** - * Operation listPositionsWithHttpInfo + * Operation listFuturesAccountsWithHttpInfo * - * List all positions of a user + * Query futures account * * @param string $settle Settle currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesAccount, HTTP status code, HTTP response headers (array of strings) */ - public function listPositionsWithHttpInfo($settle) + public function listFuturesAccountsWithHttpInfo($settle) { - $request = $this->listPositionsRequest($settle); + $request = $this->listFuturesAccountsRequest($settle); $options = $this->createHttpClientOption(); try { @@ -3779,7 +3836,7 @@ public function listPositionsWithHttpInfo($settle) ); } - $returnType = '\GateApi\Model\Position[]'; + $returnType = '\GateApi\Model\FuturesAccount'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -3795,18 +3852,18 @@ public function listPositionsWithHttpInfo($settle) } /** - * Operation listPositionsAsync + * Operation listFuturesAccountsAsync * - * List all positions of a user + * Query futures account * * @param string $settle Settle currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listPositionsAsync($settle) + public function listFuturesAccountsAsync($settle) { - return $this->listPositionsAsyncWithHttpInfo($settle) + return $this->listFuturesAccountsAsyncWithHttpInfo($settle) ->then( function ($response) { return $response[0]; @@ -3815,19 +3872,19 @@ function ($response) { } /** - * Operation listPositionsAsyncWithHttpInfo + * Operation listFuturesAccountsAsyncWithHttpInfo * - * List all positions of a user + * Query futures account * * @param string $settle Settle currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listPositionsAsyncWithHttpInfo($settle) + public function listFuturesAccountsAsyncWithHttpInfo($settle) { - $returnType = '\GateApi\Model\Position[]'; - $request = $this->listPositionsRequest($settle); + $returnType = '\GateApi\Model\FuturesAccount'; + $request = $this->listFuturesAccountsRequest($settle); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3864,23 +3921,23 @@ function ($exception) { } /** - * Create request for operation 'listPositions' + * Create request for operation 'listFuturesAccounts' * * @param string $settle Settle currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listPositionsRequest($settle) + protected function listFuturesAccountsRequest($settle) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listPositions' + 'Missing the required parameter $settle when calling listFuturesAccounts' ); } - $resourcePath = '/futures/{settle}/positions'; + $resourcePath = '/futures/{settle}/accounts'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3964,38 +4021,48 @@ protected function listPositionsRequest($settle) } /** - * Operation getPosition + * Operation listFuturesAccountBook * - * Get single position + * Query account book * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Position + * @return \GateApi\Model\FuturesAccountBook[] */ - public function getPosition($settle, $contract) + public function listFuturesAccountBook($associative_array) { - list($response) = $this->getPositionWithHttpInfo($settle, $contract); + list($response) = $this->listFuturesAccountBookWithHttpInfo($associative_array); return $response; } /** - * Operation getPositionWithHttpInfo + * Operation listFuturesAccountBookWithHttpInfo * - * Get single position + * Query account book * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Position, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesAccountBook[], HTTP status code, HTTP response headers (array of strings) */ - public function getPositionWithHttpInfo($settle, $contract) + public function listFuturesAccountBookWithHttpInfo($associative_array) { - $request = $this->getPositionRequest($settle, $contract); + $request = $this->listFuturesAccountBookRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -4021,7 +4088,7 @@ public function getPositionWithHttpInfo($settle, $contract) ); } - $returnType = '\GateApi\Model\Position'; + $returnType = '\GateApi\Model\FuturesAccountBook[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -4037,19 +4104,24 @@ public function getPositionWithHttpInfo($settle, $contract) } /** - * Operation getPositionAsync + * Operation listFuturesAccountBookAsync * - * Get single position + * Query account book * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPositionAsync($settle, $contract) + public function listFuturesAccountBookAsync($associative_array) { - return $this->getPositionAsyncWithHttpInfo($settle, $contract) + return $this->listFuturesAccountBookAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -4058,20 +4130,25 @@ function ($response) { } /** - * Operation getPositionAsyncWithHttpInfo + * Operation listFuturesAccountBookAsyncWithHttpInfo * - * Get single position + * Query account book * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPositionAsyncWithHttpInfo($settle, $contract) + public function listFuturesAccountBookAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\Position'; - $request = $this->getPositionRequest($settle, $contract); + $returnType = '\GateApi\Model\FuturesAccountBook[]'; + $request = $this->listFuturesAccountBookRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4108,36 +4185,97 @@ function ($exception) { } /** - * Create request for operation 'getPosition' + * Create request for operation 'listFuturesAccountBook' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getPositionRequest($settle, $contract) + protected function listFuturesAccountBookRequest($associative_array) { + // unbox the parameters from the associative array + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $type = array_key_exists('type', $associative_array) ? $associative_array['type'] : null; + // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling getPosition' + 'Missing the required parameter $settle when calling listFuturesAccountBook' ); } - // verify the required parameter 'contract' is set - if ($contract === null || (is_array($contract) && count($contract) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling getPosition' - ); + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesAccountBook, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesAccountBook, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/positions/{contract}'; + + $resourcePath = '/futures/{settle}/account_book'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($type !== null) { + if('form' === 'form' && is_array($type)) { + foreach($type as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['type'] = $type; + } + } + // path params if ($settle !== null) { $resourcePath = str_replace( @@ -4147,15 +4285,6 @@ protected function getPositionRequest($settle, $contract) ); } - // path params - if ($contract !== null) { - $resourcePath = str_replace( - '{' . 'contract' . '}', - ObjectSerializer::toPathValue($contract), - $resourcePath - ); - } - // body params $_tempBody = null; @@ -4224,40 +4353,36 @@ protected function getPositionRequest($settle, $contract) } /** - * Operation updatePositionMargin + * Operation listPositions * - * Update position margin + * List all positions of a user * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $settle Settle currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Position + * @return \GateApi\Model\Position[] */ - public function updatePositionMargin($settle, $contract, $change) + public function listPositions($settle) { - list($response) = $this->updatePositionMarginWithHttpInfo($settle, $contract, $change); + list($response) = $this->listPositionsWithHttpInfo($settle); return $response; } /** - * Operation updatePositionMarginWithHttpInfo + * Operation listPositionsWithHttpInfo * - * Update position margin + * List all positions of a user * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $settle Settle currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Position, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) */ - public function updatePositionMarginWithHttpInfo($settle, $contract, $change) + public function listPositionsWithHttpInfo($settle) { - $request = $this->updatePositionMarginRequest($settle, $contract, $change); + $request = $this->listPositionsRequest($settle); $options = $this->createHttpClientOption(); try { @@ -4283,7 +4408,7 @@ public function updatePositionMarginWithHttpInfo($settle, $contract, $change) ); } - $returnType = '\GateApi\Model\Position'; + $returnType = '\GateApi\Model\Position[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -4299,20 +4424,18 @@ public function updatePositionMarginWithHttpInfo($settle, $contract, $change) } /** - * Operation updatePositionMarginAsync + * Operation listPositionsAsync * - * Update position margin + * List all positions of a user * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $settle Settle currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePositionMarginAsync($settle, $contract, $change) + public function listPositionsAsync($settle) { - return $this->updatePositionMarginAsyncWithHttpInfo($settle, $contract, $change) + return $this->listPositionsAsyncWithHttpInfo($settle) ->then( function ($response) { return $response[0]; @@ -4321,21 +4444,19 @@ function ($response) { } /** - * Operation updatePositionMarginAsyncWithHttpInfo + * Operation listPositionsAsyncWithHttpInfo * - * Update position margin + * List all positions of a user * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $settle Settle currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePositionMarginAsyncWithHttpInfo($settle, $contract, $change) + public function listPositionsAsyncWithHttpInfo($settle) { - $returnType = '\GateApi\Model\Position'; - $request = $this->updatePositionMarginRequest($settle, $contract, $change); + $returnType = '\GateApi\Model\Position[]'; + $request = $this->listPositionsRequest($settle); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4372,55 +4493,29 @@ function ($exception) { } /** - * Create request for operation 'updatePositionMargin' + * Create request for operation 'listPositions' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $settle Settle currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updatePositionMarginRequest($settle, $contract, $change) + protected function listPositionsRequest($settle) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling updatePositionMargin' - ); - } - // verify the required parameter 'contract' is set - if ($contract === null || (is_array($contract) && count($contract) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling updatePositionMargin' - ); - } - // verify the required parameter 'change' is set - if ($change === null || (is_array($change) && count($change) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $change when calling updatePositionMargin' + 'Missing the required parameter $settle when calling listPositions' ); } - $resourcePath = '/futures/{settle}/positions/{contract}/margin'; + $resourcePath = '/futures/{settle}/positions'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($change !== null) { - if('form' === 'form' && is_array($change)) { - foreach($change as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['change'] = $change; - } - } - // path params if ($settle !== null) { $resourcePath = str_replace( @@ -4430,15 +4525,6 @@ protected function updatePositionMarginRequest($settle, $contract, $change) ); } - // path params - if ($contract !== null) { - $resourcePath = str_replace( - '{' . 'contract' . '}', - ObjectSerializer::toPathValue($contract), - $resourcePath - ); - } - // body params $_tempBody = null; @@ -4483,7 +4569,7 @@ protected function updatePositionMarginRequest($settle, $contract, $change) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -4499,7 +4585,7 @@ protected function updatePositionMarginRequest($settle, $contract, $change) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -4507,42 +4593,38 @@ protected function updatePositionMarginRequest($settle, $contract, $change) } /** - * Operation updatePositionLeverage + * Operation getPosition * - * Update position leverage + * Get single position * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) - * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\Position */ - public function updatePositionLeverage($settle, $contract, $leverage, $cross_leverage_limit = null) + public function getPosition($settle, $contract) { - list($response) = $this->updatePositionLeverageWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit); + list($response) = $this->getPositionWithHttpInfo($settle, $contract); return $response; } /** - * Operation updatePositionLeverageWithHttpInfo + * Operation getPositionWithHttpInfo * - * Update position leverage + * Get single position * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) - * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\Position, HTTP status code, HTTP response headers (array of strings) */ - public function updatePositionLeverageWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit = null) + public function getPositionWithHttpInfo($settle, $contract) { - $request = $this->updatePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit); + $request = $this->getPositionRequest($settle, $contract); $options = $this->createHttpClientOption(); try { @@ -4584,21 +4666,19 @@ public function updatePositionLeverageWithHttpInfo($settle, $contract, $leverage } /** - * Operation updatePositionLeverageAsync + * Operation getPositionAsync * - * Update position leverage + * Get single position * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) - * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePositionLeverageAsync($settle, $contract, $leverage, $cross_leverage_limit = null) + public function getPositionAsync($settle, $contract) { - return $this->updatePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit) + return $this->getPositionAsyncWithHttpInfo($settle, $contract) ->then( function ($response) { return $response[0]; @@ -4607,22 +4687,20 @@ function ($response) { } /** - * Operation updatePositionLeverageAsyncWithHttpInfo + * Operation getPositionAsyncWithHttpInfo * - * Update position leverage + * Get single position * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) - * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit = null) + public function getPositionAsyncWithHttpInfo($settle, $contract) { $returnType = '\GateApi\Model\Position'; - $request = $this->updatePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit); + $request = $this->getPositionRequest($settle, $contract); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4659,68 +4737,36 @@ function ($exception) { } /** - * Create request for operation 'updatePositionLeverage' + * Create request for operation 'getPosition' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) - * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updatePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit = null) + protected function getPositionRequest($settle, $contract) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling updatePositionLeverage' + 'Missing the required parameter $settle when calling getPosition' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling updatePositionLeverage' - ); - } - // verify the required parameter 'leverage' is set - if ($leverage === null || (is_array($leverage) && count($leverage) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leverage when calling updatePositionLeverage' + 'Missing the required parameter $contract when calling getPosition' ); } - $resourcePath = '/futures/{settle}/positions/{contract}/leverage'; + $resourcePath = '/futures/{settle}/positions/{contract}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($leverage !== null) { - if('form' === 'form' && is_array($leverage)) { - foreach($leverage as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['leverage'] = $leverage; - } - } - - // query params - if ($cross_leverage_limit !== null) { - if('form' === 'form' && is_array($cross_leverage_limit)) { - foreach($cross_leverage_limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['cross_leverage_limit'] = $cross_leverage_limit; - } - } - // path params if ($settle !== null) { $resourcePath = str_replace( @@ -4783,7 +4829,7 @@ protected function updatePositionLeverageRequest($settle, $contract, $leverage, } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -4799,7 +4845,7 @@ protected function updatePositionLeverageRequest($settle, $contract, $leverage, $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -4807,40 +4853,40 @@ protected function updatePositionLeverageRequest($settle, $contract, $leverage, } /** - * Operation updatePositionRiskLimit + * Operation updatePositionMargin * - * Update position risk limit + * Update position margin * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\Position */ - public function updatePositionRiskLimit($settle, $contract, $risk_limit) + public function updatePositionMargin($settle, $contract, $change) { - list($response) = $this->updatePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit); + list($response) = $this->updatePositionMarginWithHttpInfo($settle, $contract, $change); return $response; } /** - * Operation updatePositionRiskLimitWithHttpInfo + * Operation updatePositionMarginWithHttpInfo * - * Update position risk limit + * Update position margin * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\Position, HTTP status code, HTTP response headers (array of strings) */ - public function updatePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit) + public function updatePositionMarginWithHttpInfo($settle, $contract, $change) { - $request = $this->updatePositionRiskLimitRequest($settle, $contract, $risk_limit); + $request = $this->updatePositionMarginRequest($settle, $contract, $change); $options = $this->createHttpClientOption(); try { @@ -4882,20 +4928,20 @@ public function updatePositionRiskLimitWithHttpInfo($settle, $contract, $risk_li } /** - * Operation updatePositionRiskLimitAsync + * Operation updatePositionMarginAsync * - * Update position risk limit + * Update position margin * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePositionRiskLimitAsync($settle, $contract, $risk_limit) + public function updatePositionMarginAsync($settle, $contract, $change) { - return $this->updatePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) + return $this->updatePositionMarginAsyncWithHttpInfo($settle, $contract, $change) ->then( function ($response) { return $response[0]; @@ -4904,21 +4950,21 @@ function ($response) { } /** - * Operation updatePositionRiskLimitAsyncWithHttpInfo + * Operation updatePositionMarginAsyncWithHttpInfo * - * Update position risk limit + * Update position margin * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updatePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) + public function updatePositionMarginAsyncWithHttpInfo($settle, $contract, $change) { $returnType = '\GateApi\Model\Position'; - $request = $this->updatePositionRiskLimitRequest($settle, $contract, $risk_limit); + $request = $this->updatePositionMarginRequest($settle, $contract, $change); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4955,37 +5001,37 @@ function ($exception) { } /** - * Create request for operation 'updatePositionRiskLimit' + * Create request for operation 'updatePositionMargin' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updatePositionRiskLimitRequest($settle, $contract, $risk_limit) + protected function updatePositionMarginRequest($settle, $contract, $change) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling updatePositionRiskLimit' + 'Missing the required parameter $settle when calling updatePositionMargin' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling updatePositionRiskLimit' + 'Missing the required parameter $contract when calling updatePositionMargin' ); } - // verify the required parameter 'risk_limit' is set - if ($risk_limit === null || (is_array($risk_limit) && count($risk_limit) === 0)) { + // verify the required parameter 'change' is set + if ($change === null || (is_array($change) && count($change) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $risk_limit when calling updatePositionRiskLimit' + 'Missing the required parameter $change when calling updatePositionMargin' ); } - $resourcePath = '/futures/{settle}/positions/{contract}/risk_limit'; + $resourcePath = '/futures/{settle}/positions/{contract}/margin'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4993,14 +5039,14 @@ protected function updatePositionRiskLimitRequest($settle, $contract, $risk_limi $multipart = false; // query params - if ($risk_limit !== null) { - if('form' === 'form' && is_array($risk_limit)) { - foreach($risk_limit as $key => $value) { + if ($change !== null) { + if('form' === 'form' && is_array($change)) { + foreach($change as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['risk_limit'] = $risk_limit; + $queryParams['change'] = $change; } } @@ -5090,38 +5136,42 @@ protected function updatePositionRiskLimitRequest($settle, $contract, $risk_limi } /** - * Operation setDualMode + * Operation updatePositionLeverage * - * Enable or disable dual mode + * Update position leverage * - * @param string $settle Settle currency (required) - * @param bool $dual_mode Whether to enable dual mode (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesAccount + * @return \GateApi\Model\Position */ - public function setDualMode($settle, $dual_mode) + public function updatePositionLeverage($settle, $contract, $leverage, $cross_leverage_limit = null) { - list($response) = $this->setDualModeWithHttpInfo($settle, $dual_mode); + list($response) = $this->updatePositionLeverageWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit); return $response; } /** - * Operation setDualModeWithHttpInfo + * Operation updatePositionLeverageWithHttpInfo * - * Enable or disable dual mode + * Update position leverage * - * @param string $settle Settle currency (required) - * @param bool $dual_mode Whether to enable dual mode (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesAccount, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Position, HTTP status code, HTTP response headers (array of strings) */ - public function setDualModeWithHttpInfo($settle, $dual_mode) + public function updatePositionLeverageWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit = null) { - $request = $this->setDualModeRequest($settle, $dual_mode); + $request = $this->updatePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit); $options = $this->createHttpClientOption(); try { @@ -5147,7 +5197,7 @@ public function setDualModeWithHttpInfo($settle, $dual_mode) ); } - $returnType = '\GateApi\Model\FuturesAccount'; + $returnType = '\GateApi\Model\Position'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5163,19 +5213,21 @@ public function setDualModeWithHttpInfo($settle, $dual_mode) } /** - * Operation setDualModeAsync + * Operation updatePositionLeverageAsync * - * Enable or disable dual mode + * Update position leverage * - * @param string $settle Settle currency (required) - * @param bool $dual_mode Whether to enable dual mode (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function setDualModeAsync($settle, $dual_mode) + public function updatePositionLeverageAsync($settle, $contract, $leverage, $cross_leverage_limit = null) { - return $this->setDualModeAsyncWithHttpInfo($settle, $dual_mode) + return $this->updatePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit) ->then( function ($response) { return $response[0]; @@ -5184,20 +5236,22 @@ function ($response) { } /** - * Operation setDualModeAsyncWithHttpInfo + * Operation updatePositionLeverageAsyncWithHttpInfo * - * Enable or disable dual mode + * Update position leverage * - * @param string $settle Settle currency (required) - * @param bool $dual_mode Whether to enable dual mode (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function setDualModeAsyncWithHttpInfo($settle, $dual_mode) + public function updatePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit = null) { - $returnType = '\GateApi\Model\FuturesAccount'; - $request = $this->setDualModeRequest($settle, $dual_mode); + $returnType = '\GateApi\Model\Position'; + $request = $this->updatePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5234,30 +5288,38 @@ function ($exception) { } /** - * Create request for operation 'setDualMode' + * Create request for operation 'updatePositionLeverage' * - * @param string $settle Settle currency (required) - * @param bool $dual_mode Whether to enable dual mode (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function setDualModeRequest($settle, $dual_mode) + protected function updatePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit = null) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling setDualMode' + 'Missing the required parameter $settle when calling updatePositionLeverage' ); } - // verify the required parameter 'dual_mode' is set - if ($dual_mode === null || (is_array($dual_mode) && count($dual_mode) === 0)) { + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $dual_mode when calling setDualMode' + 'Missing the required parameter $contract when calling updatePositionLeverage' + ); + } + // verify the required parameter 'leverage' is set + if ($leverage === null || (is_array($leverage) && count($leverage) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $leverage when calling updatePositionLeverage' ); } - $resourcePath = '/futures/{settle}/dual_mode'; + $resourcePath = '/futures/{settle}/positions/{contract}/leverage'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5265,14 +5327,26 @@ protected function setDualModeRequest($settle, $dual_mode) $multipart = false; // query params - if ($dual_mode !== null) { - if('form' === 'form' && is_array($dual_mode)) { - foreach($dual_mode as $key => $value) { + if ($leverage !== null) { + if('form' === 'form' && is_array($leverage)) { + foreach($leverage as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['dual_mode'] = $dual_mode; + $queryParams['leverage'] = $leverage; + } + } + + // query params + if ($cross_leverage_limit !== null) { + if('form' === 'form' && is_array($cross_leverage_limit)) { + foreach($cross_leverage_limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['cross_leverage_limit'] = $cross_leverage_limit; } } @@ -5285,6 +5359,15 @@ protected function setDualModeRequest($settle, $dual_mode) ); } + // path params + if ($contract !== null) { + $resourcePath = str_replace( + '{' . 'contract' . '}', + ObjectSerializer::toPathValue($contract), + $resourcePath + ); + } + // body params $_tempBody = null; @@ -5353,38 +5436,40 @@ protected function setDualModeRequest($settle, $dual_mode) } /** - * Operation getDualModePosition + * Operation updatePositionRiskLimit * - * Retrieve position detail in dual mode + * Update position risk limit * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Position[] + * @return \GateApi\Model\Position */ - public function getDualModePosition($settle, $contract) + public function updatePositionRiskLimit($settle, $contract, $risk_limit) { - list($response) = $this->getDualModePositionWithHttpInfo($settle, $contract); + list($response) = $this->updatePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit); return $response; } /** - * Operation getDualModePositionWithHttpInfo + * Operation updatePositionRiskLimitWithHttpInfo * - * Retrieve position detail in dual mode + * Update position risk limit * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Position, HTTP status code, HTTP response headers (array of strings) */ - public function getDualModePositionWithHttpInfo($settle, $contract) + public function updatePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit) { - $request = $this->getDualModePositionRequest($settle, $contract); + $request = $this->updatePositionRiskLimitRequest($settle, $contract, $risk_limit); $options = $this->createHttpClientOption(); try { @@ -5410,7 +5495,7 @@ public function getDualModePositionWithHttpInfo($settle, $contract) ); } - $returnType = '\GateApi\Model\Position[]'; + $returnType = '\GateApi\Model\Position'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5426,19 +5511,20 @@ public function getDualModePositionWithHttpInfo($settle, $contract) } /** - * Operation getDualModePositionAsync + * Operation updatePositionRiskLimitAsync * - * Retrieve position detail in dual mode + * Update position risk limit * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getDualModePositionAsync($settle, $contract) + public function updatePositionRiskLimitAsync($settle, $contract, $risk_limit) { - return $this->getDualModePositionAsyncWithHttpInfo($settle, $contract) + return $this->updatePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) ->then( function ($response) { return $response[0]; @@ -5447,20 +5533,21 @@ function ($response) { } /** - * Operation getDualModePositionAsyncWithHttpInfo + * Operation updatePositionRiskLimitAsyncWithHttpInfo * - * Retrieve position detail in dual mode + * Update position risk limit * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getDualModePositionAsyncWithHttpInfo($settle, $contract) + public function updatePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) { - $returnType = '\GateApi\Model\Position[]'; - $request = $this->getDualModePositionRequest($settle, $contract); + $returnType = '\GateApi\Model\Position'; + $request = $this->updatePositionRiskLimitRequest($settle, $contract, $risk_limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5497,36 +5584,55 @@ function ($exception) { } /** - * Create request for operation 'getDualModePosition' + * Create request for operation 'updatePositionRiskLimit' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getDualModePositionRequest($settle, $contract) + protected function updatePositionRiskLimitRequest($settle, $contract, $risk_limit) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling getDualModePosition' + 'Missing the required parameter $settle when calling updatePositionRiskLimit' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling getDualModePosition' + 'Missing the required parameter $contract when calling updatePositionRiskLimit' + ); + } + // verify the required parameter 'risk_limit' is set + if ($risk_limit === null || (is_array($risk_limit) && count($risk_limit) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $risk_limit when calling updatePositionRiskLimit' ); } - $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}'; + $resourcePath = '/futures/{settle}/positions/{contract}/risk_limit'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($risk_limit !== null) { + if('form' === 'form' && is_array($risk_limit)) { + foreach($risk_limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['risk_limit'] = $risk_limit; + } + } + // path params if ($settle !== null) { $resourcePath = str_replace( @@ -5589,7 +5695,7 @@ protected function getDualModePositionRequest($settle, $contract) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -5605,7 +5711,7 @@ protected function getDualModePositionRequest($settle, $contract) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -5613,42 +5719,38 @@ protected function getDualModePositionRequest($settle, $contract) } /** - * Operation updateDualModePositionMargin + * Operation setDualMode * - * Update position margin in dual mode + * Enable or disable dual mode * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) - * @param string $dual_side Long or short position (required) + * @param bool $dual_mode Whether to enable dual mode (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Position[] + * @return \GateApi\Model\FuturesAccount */ - public function updateDualModePositionMargin($settle, $contract, $change, $dual_side) + public function setDualMode($settle, $dual_mode) { - list($response) = $this->updateDualModePositionMarginWithHttpInfo($settle, $contract, $change, $dual_side); + list($response) = $this->setDualModeWithHttpInfo($settle, $dual_mode); return $response; } /** - * Operation updateDualModePositionMarginWithHttpInfo + * Operation setDualModeWithHttpInfo * - * Update position margin in dual mode + * Enable or disable dual mode * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) - * @param string $dual_side Long or short position (required) + * @param bool $dual_mode Whether to enable dual mode (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesAccount, HTTP status code, HTTP response headers (array of strings) */ - public function updateDualModePositionMarginWithHttpInfo($settle, $contract, $change, $dual_side) + public function setDualModeWithHttpInfo($settle, $dual_mode) { - $request = $this->updateDualModePositionMarginRequest($settle, $contract, $change, $dual_side); + $request = $this->setDualModeRequest($settle, $dual_mode); $options = $this->createHttpClientOption(); try { @@ -5674,7 +5776,7 @@ public function updateDualModePositionMarginWithHttpInfo($settle, $contract, $ch ); } - $returnType = '\GateApi\Model\Position[]'; + $returnType = '\GateApi\Model\FuturesAccount'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5690,21 +5792,19 @@ public function updateDualModePositionMarginWithHttpInfo($settle, $contract, $ch } /** - * Operation updateDualModePositionMarginAsync + * Operation setDualModeAsync * - * Update position margin in dual mode + * Enable or disable dual mode * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) - * @param string $dual_side Long or short position (required) + * @param bool $dual_mode Whether to enable dual mode (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDualModePositionMarginAsync($settle, $contract, $change, $dual_side) + public function setDualModeAsync($settle, $dual_mode) { - return $this->updateDualModePositionMarginAsyncWithHttpInfo($settle, $contract, $change, $dual_side) + return $this->setDualModeAsyncWithHttpInfo($settle, $dual_mode) ->then( function ($response) { return $response[0]; @@ -5713,22 +5813,20 @@ function ($response) { } /** - * Operation updateDualModePositionMarginAsyncWithHttpInfo + * Operation setDualModeAsyncWithHttpInfo * - * Update position margin in dual mode + * Enable or disable dual mode * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) - * @param string $dual_side Long or short position (required) + * @param bool $dual_mode Whether to enable dual mode (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDualModePositionMarginAsyncWithHttpInfo($settle, $contract, $change, $dual_side) + public function setDualModeAsyncWithHttpInfo($settle, $dual_mode) { - $returnType = '\GateApi\Model\Position[]'; - $request = $this->updateDualModePositionMarginRequest($settle, $contract, $change, $dual_side); + $returnType = '\GateApi\Model\FuturesAccount'; + $request = $this->setDualModeRequest($settle, $dual_mode); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5765,44 +5863,30 @@ function ($exception) { } /** - * Create request for operation 'updateDualModePositionMargin' + * Create request for operation 'setDualMode' * * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) - * @param string $dual_side Long or short position (required) + * @param bool $dual_mode Whether to enable dual mode (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateDualModePositionMarginRequest($settle, $contract, $change, $dual_side) + protected function setDualModeRequest($settle, $dual_mode) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling updateDualModePositionMargin' - ); - } - // verify the required parameter 'contract' is set - if ($contract === null || (is_array($contract) && count($contract) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling updateDualModePositionMargin' - ); - } - // verify the required parameter 'change' is set - if ($change === null || (is_array($change) && count($change) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $change when calling updateDualModePositionMargin' + 'Missing the required parameter $settle when calling setDualMode' ); } - // verify the required parameter 'dual_side' is set - if ($dual_side === null || (is_array($dual_side) && count($dual_side) === 0)) { + // verify the required parameter 'dual_mode' is set + if ($dual_mode === null || (is_array($dual_mode) && count($dual_mode) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $dual_side when calling updateDualModePositionMargin' + 'Missing the required parameter $dual_mode when calling setDualMode' ); } - $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}/margin'; + $resourcePath = '/futures/{settle}/dual_mode'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5810,26 +5894,14 @@ protected function updateDualModePositionMarginRequest($settle, $contract, $chan $multipart = false; // query params - if ($change !== null) { - if('form' === 'form' && is_array($change)) { - foreach($change as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['change'] = $change; - } - } - - // query params - if ($dual_side !== null) { - if('form' === 'form' && is_array($dual_side)) { - foreach($dual_side as $key => $value) { + if ($dual_mode !== null) { + if('form' === 'form' && is_array($dual_mode)) { + foreach($dual_mode as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['dual_side'] = $dual_side; + $queryParams['dual_mode'] = $dual_mode; } } @@ -5842,15 +5914,6 @@ protected function updateDualModePositionMarginRequest($settle, $contract, $chan ); } - // path params - if ($contract !== null) { - $resourcePath = str_replace( - '{' . 'contract' . '}', - ObjectSerializer::toPathValue($contract), - $resourcePath - ); - } - // body params $_tempBody = null; @@ -5919,40 +5982,38 @@ protected function updateDualModePositionMarginRequest($settle, $contract, $chan } /** - * Operation updateDualModePositionLeverage + * Operation getDualModePosition * - * Update position leverage in dual mode + * Retrieve position detail in dual mode * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\Position[] */ - public function updateDualModePositionLeverage($settle, $contract, $leverage) + public function getDualModePosition($settle, $contract) { - list($response) = $this->updateDualModePositionLeverageWithHttpInfo($settle, $contract, $leverage); + list($response) = $this->getDualModePositionWithHttpInfo($settle, $contract); return $response; } /** - * Operation updateDualModePositionLeverageWithHttpInfo + * Operation getDualModePositionWithHttpInfo * - * Update position leverage in dual mode + * Retrieve position detail in dual mode * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) */ - public function updateDualModePositionLeverageWithHttpInfo($settle, $contract, $leverage) + public function getDualModePositionWithHttpInfo($settle, $contract) { - $request = $this->updateDualModePositionLeverageRequest($settle, $contract, $leverage); + $request = $this->getDualModePositionRequest($settle, $contract); $options = $this->createHttpClientOption(); try { @@ -5994,20 +6055,19 @@ public function updateDualModePositionLeverageWithHttpInfo($settle, $contract, $ } /** - * Operation updateDualModePositionLeverageAsync + * Operation getDualModePositionAsync * - * Update position leverage in dual mode + * Retrieve position detail in dual mode * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDualModePositionLeverageAsync($settle, $contract, $leverage) + public function getDualModePositionAsync($settle, $contract) { - return $this->updateDualModePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage) + return $this->getDualModePositionAsyncWithHttpInfo($settle, $contract) ->then( function ($response) { return $response[0]; @@ -6016,21 +6076,20 @@ function ($response) { } /** - * Operation updateDualModePositionLeverageAsyncWithHttpInfo + * Operation getDualModePositionAsyncWithHttpInfo * - * Update position leverage in dual mode + * Retrieve position detail in dual mode * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDualModePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage) + public function getDualModePositionAsyncWithHttpInfo($settle, $contract) { $returnType = '\GateApi\Model\Position[]'; - $request = $this->updateDualModePositionLeverageRequest($settle, $contract, $leverage); + $request = $this->getDualModePositionRequest($settle, $contract); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6067,55 +6126,36 @@ function ($exception) { } /** - * Create request for operation 'updateDualModePositionLeverage' + * Create request for operation 'getDualModePosition' * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $leverage New position leverage (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateDualModePositionLeverageRequest($settle, $contract, $leverage) + protected function getDualModePositionRequest($settle, $contract) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling updateDualModePositionLeverage' + 'Missing the required parameter $settle when calling getDualModePosition' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling updateDualModePositionLeverage' - ); - } - // verify the required parameter 'leverage' is set - if ($leverage === null || (is_array($leverage) && count($leverage) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $leverage when calling updateDualModePositionLeverage' + 'Missing the required parameter $contract when calling getDualModePosition' ); } - $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}/leverage'; + $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($leverage !== null) { - if('form' === 'form' && is_array($leverage)) { - foreach($leverage as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['leverage'] = $leverage; - } - } - // path params if ($settle !== null) { $resourcePath = str_replace( @@ -6178,7 +6218,7 @@ protected function updateDualModePositionLeverageRequest($settle, $contract, $le } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -6194,7 +6234,7 @@ protected function updateDualModePositionLeverageRequest($settle, $contract, $le $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -6202,40 +6242,42 @@ protected function updateDualModePositionLeverageRequest($settle, $contract, $le } /** - * Operation updateDualModePositionRiskLimit + * Operation updateDualModePositionMargin * - * Update position risk limit in dual mode + * Update position margin in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $dual_side Long or short position (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\Position[] */ - public function updateDualModePositionRiskLimit($settle, $contract, $risk_limit) + public function updateDualModePositionMargin($settle, $contract, $change, $dual_side) { - list($response) = $this->updateDualModePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit); + list($response) = $this->updateDualModePositionMarginWithHttpInfo($settle, $contract, $change, $dual_side); return $response; } /** - * Operation updateDualModePositionRiskLimitWithHttpInfo + * Operation updateDualModePositionMarginWithHttpInfo * - * Update position risk limit in dual mode + * Update position margin in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $dual_side Long or short position (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) */ - public function updateDualModePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit) + public function updateDualModePositionMarginWithHttpInfo($settle, $contract, $change, $dual_side) { - $request = $this->updateDualModePositionRiskLimitRequest($settle, $contract, $risk_limit); + $request = $this->updateDualModePositionMarginRequest($settle, $contract, $change, $dual_side); $options = $this->createHttpClientOption(); try { @@ -6277,20 +6319,21 @@ public function updateDualModePositionRiskLimitWithHttpInfo($settle, $contract, } /** - * Operation updateDualModePositionRiskLimitAsync + * Operation updateDualModePositionMarginAsync * - * Update position risk limit in dual mode + * Update position margin in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $dual_side Long or short position (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDualModePositionRiskLimitAsync($settle, $contract, $risk_limit) + public function updateDualModePositionMarginAsync($settle, $contract, $change, $dual_side) { - return $this->updateDualModePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) + return $this->updateDualModePositionMarginAsyncWithHttpInfo($settle, $contract, $change, $dual_side) ->then( function ($response) { return $response[0]; @@ -6299,21 +6342,22 @@ function ($response) { } /** - * Operation updateDualModePositionRiskLimitAsyncWithHttpInfo + * Operation updateDualModePositionMarginAsyncWithHttpInfo * - * Update position risk limit in dual mode + * Update position margin in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $dual_side Long or short position (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateDualModePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) + public function updateDualModePositionMarginAsyncWithHttpInfo($settle, $contract, $change, $dual_side) { $returnType = '\GateApi\Model\Position[]'; - $request = $this->updateDualModePositionRiskLimitRequest($settle, $contract, $risk_limit); + $request = $this->updateDualModePositionMarginRequest($settle, $contract, $change, $dual_side); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6350,37 +6394,44 @@ function ($exception) { } /** - * Create request for operation 'updateDualModePositionRiskLimit' + * Create request for operation 'updateDualModePositionMargin' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $risk_limit New position risk limit (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $change Margin change. Use positive number to increase margin, negative number otherwise. (required) + * @param string $dual_side Long or short position (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function updateDualModePositionRiskLimitRequest($settle, $contract, $risk_limit) + protected function updateDualModePositionMarginRequest($settle, $contract, $change, $dual_side) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling updateDualModePositionRiskLimit' + 'Missing the required parameter $settle when calling updateDualModePositionMargin' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling updateDualModePositionRiskLimit' + 'Missing the required parameter $contract when calling updateDualModePositionMargin' ); } - // verify the required parameter 'risk_limit' is set - if ($risk_limit === null || (is_array($risk_limit) && count($risk_limit) === 0)) { + // verify the required parameter 'change' is set + if ($change === null || (is_array($change) && count($change) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $risk_limit when calling updateDualModePositionRiskLimit' + 'Missing the required parameter $change when calling updateDualModePositionMargin' + ); + } + // verify the required parameter 'dual_side' is set + if ($dual_side === null || (is_array($dual_side) && count($dual_side) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dual_side when calling updateDualModePositionMargin' ); } - $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}/risk_limit'; + $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}/margin'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6388,14 +6439,26 @@ protected function updateDualModePositionRiskLimitRequest($settle, $contract, $r $multipart = false; // query params - if ($risk_limit !== null) { - if('form' === 'form' && is_array($risk_limit)) { - foreach($risk_limit as $key => $value) { + if ($change !== null) { + if('form' === 'form' && is_array($change)) { + foreach($change as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['risk_limit'] = $risk_limit; + $queryParams['change'] = $change; + } + } + + // query params + if ($dual_side !== null) { + if('form' === 'form' && is_array($dual_side)) { + foreach($dual_side as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['dual_side'] = $dual_side; } } @@ -6485,52 +6548,42 @@ protected function updateDualModePositionRiskLimitRequest($settle, $contract, $r } /** - * Operation listFuturesOrders - * - * List futures orders + * Operation updateDualModePositionLeverage * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Update position leverage in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $status List orders based on status (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesOrder[] + * @return \GateApi\Model\Position[] */ - public function listFuturesOrders($associative_array) + public function updateDualModePositionLeverage($settle, $contract, $leverage, $cross_leverage_limit = null) { - list($response) = $this->listFuturesOrdersWithHttpInfo($associative_array); + list($response) = $this->updateDualModePositionLeverageWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit); return $response; } /** - * Operation listFuturesOrdersWithHttpInfo - * - * List futures orders + * Operation updateDualModePositionLeverageWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Update position leverage in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $status List orders based on status (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesOrder[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) */ - public function listFuturesOrdersWithHttpInfo($associative_array) + public function updateDualModePositionLeverageWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit = null) { - $request = $this->listFuturesOrdersRequest($associative_array); + $request = $this->updateDualModePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit); $options = $this->createHttpClientOption(); try { @@ -6556,7 +6609,7 @@ public function listFuturesOrdersWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\FuturesOrder[]'; + $returnType = '\GateApi\Model\Position[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -6572,26 +6625,21 @@ public function listFuturesOrdersWithHttpInfo($associative_array) } /** - * Operation listFuturesOrdersAsync - * - * List futures orders + * Operation updateDualModePositionLeverageAsync * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Update position leverage in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $status List orders based on status (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesOrdersAsync($associative_array) + public function updateDualModePositionLeverageAsync($settle, $contract, $leverage, $cross_leverage_limit = null) { - return $this->listFuturesOrdersAsyncWithHttpInfo($associative_array) + return $this->updateDualModePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit) ->then( function ($response) { return $response[0]; @@ -6600,27 +6648,22 @@ function ($response) { } /** - * Operation listFuturesOrdersAsyncWithHttpInfo - * - * List futures orders + * Operation updateDualModePositionLeverageAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Update position leverage in dual mode * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $status List orders based on status (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listFuturesOrdersAsyncWithHttpInfo($associative_array) + public function updateDualModePositionLeverageAsyncWithHttpInfo($settle, $contract, $leverage, $cross_leverage_limit = null) { - $returnType = '\GateApi\Model\FuturesOrder[]'; - $request = $this->listFuturesOrdersRequest($associative_array); + $returnType = '\GateApi\Model\Position[]'; + $request = $this->updateDualModePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6657,63 +6700,38 @@ function ($exception) { } /** - * Create request for operation 'listFuturesOrders' - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create request for operation 'updateDualModePositionLeverage' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract (required) - * @param string $status List orders based on status (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $leverage New position leverage (required) + * @param string $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listFuturesOrdersRequest($associative_array) + protected function updateDualModePositionLeverageRequest($settle, $contract, $leverage, $cross_leverage_limit = null) { - // unbox the parameters from the associative array - $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; - $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; - $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; - $last_id = array_key_exists('last_id', $associative_array) ? $associative_array['last_id'] : null; - $count_total = array_key_exists('count_total', $associative_array) ? $associative_array['count_total'] : 0; - // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listFuturesOrders' + 'Missing the required parameter $settle when calling updateDualModePositionLeverage' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling listFuturesOrders' + 'Missing the required parameter $contract when calling updateDualModePositionLeverage' ); } - // verify the required parameter 'status' is set - if ($status === null || (is_array($status) && count($status) === 0)) { + // verify the required parameter 'leverage' is set + if ($leverage === null || (is_array($leverage) && count($leverage) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $status when calling listFuturesOrders' + 'Missing the required parameter $leverage when calling updateDualModePositionLeverage' ); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesOrders, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesOrders, must be bigger than or equal to 1.'); - } - if ($offset !== null && $offset < 0) { - throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.listFuturesOrders, must be bigger than or equal to 0.'); - } - - - $resourcePath = '/futures/{settle}/orders'; + $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}/leverage'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6721,74 +6739,26 @@ protected function listFuturesOrdersRequest($associative_array) $multipart = false; // query params - if ($contract !== null) { - if('form' === 'form' && is_array($contract)) { - foreach($contract as $key => $value) { + if ($leverage !== null) { + if('form' === 'form' && is_array($leverage)) { + foreach($leverage as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['contract'] = $contract; + $queryParams['leverage'] = $leverage; } } // query params - if ($status !== null) { - if('form' === 'form' && is_array($status)) { - foreach($status as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['status'] = $status; - } - } - - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - - // query params - if ($offset !== null) { - if('form' === 'form' && is_array($offset)) { - foreach($offset as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['offset'] = $offset; - } - } - - // query params - if ($last_id !== null) { - if('form' === 'form' && is_array($last_id)) { - foreach($last_id as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['last_id'] = $last_id; - } - } - - // query params - if ($count_total !== null) { - if('form' === 'form' && is_array($count_total)) { - foreach($count_total as $key => $value) { + if ($cross_leverage_limit !== null) { + if('form' === 'form' && is_array($cross_leverage_limit)) { + foreach($cross_leverage_limit as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['count_total'] = $count_total; + $queryParams['cross_leverage_limit'] = $cross_leverage_limit; } } @@ -6801,6 +6771,15 @@ protected function listFuturesOrdersRequest($associative_array) ); } + // path params + if ($contract !== null) { + $resourcePath = str_replace( + '{' . 'contract' . '}', + ObjectSerializer::toPathValue($contract), + $resourcePath + ); + } + // body params $_tempBody = null; @@ -6845,7 +6824,7 @@ protected function listFuturesOrdersRequest($associative_array) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -6861,7 +6840,7 @@ protected function listFuturesOrdersRequest($associative_array) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -6869,38 +6848,40 @@ protected function listFuturesOrdersRequest($associative_array) } /** - * Operation createFuturesOrder + * Operation updateDualModePositionRiskLimit * - * Create a futures order + * Update position risk limit in dual mode * - * @param string $settle Settle currency (required) - * @param \GateApi\Model\FuturesOrder $futures_order futures_order (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesOrder + * @return \GateApi\Model\Position[] */ - public function createFuturesOrder($settle, $futures_order) + public function updateDualModePositionRiskLimit($settle, $contract, $risk_limit) { - list($response) = $this->createFuturesOrderWithHttpInfo($settle, $futures_order); + list($response) = $this->updateDualModePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit); return $response; } /** - * Operation createFuturesOrderWithHttpInfo + * Operation updateDualModePositionRiskLimitWithHttpInfo * - * Create a futures order + * Update position risk limit in dual mode * - * @param string $settle Settle currency (required) - * @param \GateApi\Model\FuturesOrder $futures_order (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesOrder, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Position[], HTTP status code, HTTP response headers (array of strings) */ - public function createFuturesOrderWithHttpInfo($settle, $futures_order) + public function updateDualModePositionRiskLimitWithHttpInfo($settle, $contract, $risk_limit) { - $request = $this->createFuturesOrderRequest($settle, $futures_order); + $request = $this->updateDualModePositionRiskLimitRequest($settle, $contract, $risk_limit); $options = $this->createHttpClientOption(); try { @@ -6926,7 +6907,7 @@ public function createFuturesOrderWithHttpInfo($settle, $futures_order) ); } - $returnType = '\GateApi\Model\FuturesOrder'; + $returnType = '\GateApi\Model\Position[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -6942,19 +6923,20 @@ public function createFuturesOrderWithHttpInfo($settle, $futures_order) } /** - * Operation createFuturesOrderAsync + * Operation updateDualModePositionRiskLimitAsync * - * Create a futures order + * Update position risk limit in dual mode * - * @param string $settle Settle currency (required) - * @param \GateApi\Model\FuturesOrder $futures_order (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createFuturesOrderAsync($settle, $futures_order) + public function updateDualModePositionRiskLimitAsync($settle, $contract, $risk_limit) { - return $this->createFuturesOrderAsyncWithHttpInfo($settle, $futures_order) + return $this->updateDualModePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) ->then( function ($response) { return $response[0]; @@ -6963,20 +6945,21 @@ function ($response) { } /** - * Operation createFuturesOrderAsyncWithHttpInfo + * Operation updateDualModePositionRiskLimitAsyncWithHttpInfo * - * Create a futures order + * Update position risk limit in dual mode * - * @param string $settle Settle currency (required) - * @param \GateApi\Model\FuturesOrder $futures_order (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createFuturesOrderAsyncWithHttpInfo($settle, $futures_order) + public function updateDualModePositionRiskLimitAsyncWithHttpInfo($settle, $contract, $risk_limit) { - $returnType = '\GateApi\Model\FuturesOrder'; - $request = $this->createFuturesOrderRequest($settle, $futures_order); + $returnType = '\GateApi\Model\Position[]'; + $request = $this->updateDualModePositionRiskLimitRequest($settle, $contract, $risk_limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7013,36 +6996,55 @@ function ($exception) { } /** - * Create request for operation 'createFuturesOrder' + * Create request for operation 'updateDualModePositionRiskLimit' * - * @param string $settle Settle currency (required) - * @param \GateApi\Model\FuturesOrder $futures_order (required) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract (required) + * @param string $risk_limit New position risk limit (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createFuturesOrderRequest($settle, $futures_order) + protected function updateDualModePositionRiskLimitRequest($settle, $contract, $risk_limit) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling createFuturesOrder' + 'Missing the required parameter $settle when calling updateDualModePositionRiskLimit' ); } - // verify the required parameter 'futures_order' is set - if ($futures_order === null || (is_array($futures_order) && count($futures_order) === 0)) { + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $futures_order when calling createFuturesOrder' + 'Missing the required parameter $contract when calling updateDualModePositionRiskLimit' + ); + } + // verify the required parameter 'risk_limit' is set + if ($risk_limit === null || (is_array($risk_limit) && count($risk_limit) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $risk_limit when calling updateDualModePositionRiskLimit' ); } - $resourcePath = '/futures/{settle}/orders'; + $resourcePath = '/futures/{settle}/dual_comp/positions/{contract}/risk_limit'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($risk_limit !== null) { + if('form' === 'form' && is_array($risk_limit)) { + foreach($risk_limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['risk_limit'] = $risk_limit; + } + } + // path params if ($settle !== null) { $resourcePath = str_replace( @@ -7052,11 +7054,17 @@ protected function createFuturesOrderRequest($settle, $futures_order) ); } + // path params + if ($contract !== null) { + $resourcePath = str_replace( + '{' . 'contract' . '}', + ObjectSerializer::toPathValue($contract), + $resourcePath + ); + } + // body params $_tempBody = null; - if (isset($futures_order)) { - $_tempBody = $futures_order; - } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -7065,7 +7073,7 @@ protected function createFuturesOrderRequest($settle, $futures_order) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } @@ -7123,40 +7131,50 @@ protected function createFuturesOrderRequest($settle, $futures_order) } /** - * Operation cancelFuturesOrders + * Operation listFuturesOrders * - * Cancel all `open` orders matched + * List futures orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $status Only list the orders with this status (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\FuturesOrder[] */ - public function cancelFuturesOrders($settle, $contract, $side = null) + public function listFuturesOrders($associative_array) { - list($response) = $this->cancelFuturesOrdersWithHttpInfo($settle, $contract, $side); + list($response) = $this->listFuturesOrdersWithHttpInfo($associative_array); return $response; } /** - * Operation cancelFuturesOrdersWithHttpInfo + * Operation listFuturesOrdersWithHttpInfo * - * Cancel all `open` orders matched + * List futures orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $status Only list the orders with this status (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\FuturesOrder[], HTTP status code, HTTP response headers (array of strings) */ - public function cancelFuturesOrdersWithHttpInfo($settle, $contract, $side = null) + public function listFuturesOrdersWithHttpInfo($associative_array) { - $request = $this->cancelFuturesOrdersRequest($settle, $contract, $side); + $request = $this->listFuturesOrdersRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -7198,20 +7216,25 @@ public function cancelFuturesOrdersWithHttpInfo($settle, $contract, $side = null } /** - * Operation cancelFuturesOrdersAsync + * Operation listFuturesOrdersAsync * - * Cancel all `open` orders matched + * List futures orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $status Only list the orders with this status (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelFuturesOrdersAsync($settle, $contract, $side = null) + public function listFuturesOrdersAsync($associative_array) { - return $this->cancelFuturesOrdersAsyncWithHttpInfo($settle, $contract, $side) + return $this->listFuturesOrdersAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -7220,21 +7243,26 @@ function ($response) { } /** - * Operation cancelFuturesOrdersAsyncWithHttpInfo + * Operation listFuturesOrdersAsyncWithHttpInfo * - * Cancel all `open` orders matched + * List futures orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $status Only list the orders with this status (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelFuturesOrdersAsyncWithHttpInfo($settle, $contract, $side = null) + public function listFuturesOrdersAsyncWithHttpInfo($associative_array) { $returnType = '\GateApi\Model\FuturesOrder[]'; - $request = $this->cancelFuturesOrdersRequest($settle, $contract, $side); + $request = $this->listFuturesOrdersRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7271,29 +7299,59 @@ function ($exception) { } /** - * Create request for operation 'cancelFuturesOrders' + * Create request for operation 'listFuturesOrders' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract (required) - * @param string $side All bids or asks. Both included in not specified (optional) + * @param string $status Only list the orders with this status (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function cancelFuturesOrdersRequest($settle, $contract, $side = null) + protected function listFuturesOrdersRequest($associative_array) { + // unbox the parameters from the associative array + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $last_id = array_key_exists('last_id', $associative_array) ? $associative_array['last_id'] : null; + // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling cancelFuturesOrders' + 'Missing the required parameter $settle when calling listFuturesOrders' ); } // verify the required parameter 'contract' is set if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $contract when calling cancelFuturesOrders' + 'Missing the required parameter $contract when calling listFuturesOrders' + ); + } + // verify the required parameter 'status' is set + if ($status === null || (is_array($status) && count($status) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling listFuturesOrders' ); } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesOrders, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listFuturesOrders, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.listFuturesOrders, must be bigger than or equal to 0.'); + } + $resourcePath = '/futures/{settle}/orders'; $formParams = []; @@ -7315,14 +7373,50 @@ protected function cancelFuturesOrdersRequest($settle, $contract, $side = null) } // query params - if ($side !== null) { - if('form' === 'form' && is_array($side)) { - foreach($side as $key => $value) { + if ($status !== null) { + if('form' === 'form' && is_array($status)) { + foreach($status as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['side'] = $side; + $queryParams['status'] = $status; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($last_id !== null) { + if('form' === 'form' && is_array($last_id)) { + foreach($last_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['last_id'] = $last_id; } } @@ -7379,7 +7473,7 @@ protected function cancelFuturesOrdersRequest($settle, $contract, $side = null) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -7395,7 +7489,7 @@ protected function cancelFuturesOrdersRequest($settle, $contract, $side = null) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7403,38 +7497,38 @@ protected function cancelFuturesOrdersRequest($settle, $contract, $side = null) } /** - * Operation getFuturesOrder + * Operation createFuturesOrder * - * Get a single order + * Create a futures order * - * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder $futures_order futures_order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\FuturesOrder */ - public function getFuturesOrder($settle, $order_id) + public function createFuturesOrder($settle, $futures_order) { - list($response) = $this->getFuturesOrderWithHttpInfo($settle, $order_id); + list($response) = $this->createFuturesOrderWithHttpInfo($settle, $futures_order); return $response; } /** - * Operation getFuturesOrderWithHttpInfo + * Operation createFuturesOrderWithHttpInfo * - * Get a single order + * Create a futures order * - * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder $futures_order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\FuturesOrder, HTTP status code, HTTP response headers (array of strings) */ - public function getFuturesOrderWithHttpInfo($settle, $order_id) + public function createFuturesOrderWithHttpInfo($settle, $futures_order) { - $request = $this->getFuturesOrderRequest($settle, $order_id); + $request = $this->createFuturesOrderRequest($settle, $futures_order); $options = $this->createHttpClientOption(); try { @@ -7476,19 +7570,19 @@ public function getFuturesOrderWithHttpInfo($settle, $order_id) } /** - * Operation getFuturesOrderAsync + * Operation createFuturesOrderAsync * - * Get a single order + * Create a futures order * - * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder $futures_order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFuturesOrderAsync($settle, $order_id) + public function createFuturesOrderAsync($settle, $futures_order) { - return $this->getFuturesOrderAsyncWithHttpInfo($settle, $order_id) + return $this->createFuturesOrderAsyncWithHttpInfo($settle, $futures_order) ->then( function ($response) { return $response[0]; @@ -7497,20 +7591,20 @@ function ($response) { } /** - * Operation getFuturesOrderAsyncWithHttpInfo + * Operation createFuturesOrderAsyncWithHttpInfo * - * Get a single order + * Create a futures order * - * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder $futures_order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFuturesOrderAsyncWithHttpInfo($settle, $order_id) + public function createFuturesOrderAsyncWithHttpInfo($settle, $futures_order) { $returnType = '\GateApi\Model\FuturesOrder'; - $request = $this->getFuturesOrderRequest($settle, $order_id); + $request = $this->createFuturesOrderRequest($settle, $futures_order); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7547,30 +7641,30 @@ function ($exception) { } /** - * Create request for operation 'getFuturesOrder' + * Create request for operation 'createFuturesOrder' * - * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder $futures_order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getFuturesOrderRequest($settle, $order_id) + protected function createFuturesOrderRequest($settle, $futures_order) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling getFuturesOrder' + 'Missing the required parameter $settle when calling createFuturesOrder' ); } - // verify the required parameter 'order_id' is set - if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + // verify the required parameter 'futures_order' is set + if ($futures_order === null || (is_array($futures_order) && count($futures_order) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $order_id when calling getFuturesOrder' + 'Missing the required parameter $futures_order when calling createFuturesOrder' ); } - $resourcePath = '/futures/{settle}/orders/{order_id}'; + $resourcePath = '/futures/{settle}/orders'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7586,17 +7680,11 @@ protected function getFuturesOrderRequest($settle, $order_id) ); } - // path params - if ($order_id !== null) { - $resourcePath = str_replace( - '{' . 'order_id' . '}', - ObjectSerializer::toPathValue($order_id), - $resourcePath - ); - } - // body params $_tempBody = null; + if (isset($futures_order)) { + $_tempBody = $futures_order; + } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -7605,7 +7693,7 @@ protected function getFuturesOrderRequest($settle, $order_id) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } @@ -7639,7 +7727,7 @@ protected function getFuturesOrderRequest($settle, $order_id) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -7655,7 +7743,7 @@ protected function getFuturesOrderRequest($settle, $order_id) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7663,38 +7751,40 @@ protected function getFuturesOrderRequest($settle, $order_id) } /** - * Operation cancelFuturesOrder + * Operation cancelFuturesOrders * - * Cancel a single order + * Cancel all `open` orders matched * * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $contract Futures contract (required) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesOrder + * @return \GateApi\Model\FuturesOrder[] */ - public function cancelFuturesOrder($settle, $order_id) + public function cancelFuturesOrders($settle, $contract, $side = null) { - list($response) = $this->cancelFuturesOrderWithHttpInfo($settle, $order_id); + list($response) = $this->cancelFuturesOrdersWithHttpInfo($settle, $contract, $side); return $response; } /** - * Operation cancelFuturesOrderWithHttpInfo + * Operation cancelFuturesOrdersWithHttpInfo * - * Cancel a single order + * Cancel all `open` orders matched * * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $contract Futures contract (required) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesOrder, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesOrder[], HTTP status code, HTTP response headers (array of strings) */ - public function cancelFuturesOrderWithHttpInfo($settle, $order_id) + public function cancelFuturesOrdersWithHttpInfo($settle, $contract, $side = null) { - $request = $this->cancelFuturesOrderRequest($settle, $order_id); + $request = $this->cancelFuturesOrdersRequest($settle, $contract, $side); $options = $this->createHttpClientOption(); try { @@ -7720,7 +7810,7 @@ public function cancelFuturesOrderWithHttpInfo($settle, $order_id) ); } - $returnType = '\GateApi\Model\FuturesOrder'; + $returnType = '\GateApi\Model\FuturesOrder[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -7736,19 +7826,20 @@ public function cancelFuturesOrderWithHttpInfo($settle, $order_id) } /** - * Operation cancelFuturesOrderAsync + * Operation cancelFuturesOrdersAsync * - * Cancel a single order + * Cancel all `open` orders matched * * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $contract Futures contract (required) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelFuturesOrderAsync($settle, $order_id) + public function cancelFuturesOrdersAsync($settle, $contract, $side = null) { - return $this->cancelFuturesOrderAsyncWithHttpInfo($settle, $order_id) + return $this->cancelFuturesOrdersAsyncWithHttpInfo($settle, $contract, $side) ->then( function ($response) { return $response[0]; @@ -7757,20 +7848,21 @@ function ($response) { } /** - * Operation cancelFuturesOrderAsyncWithHttpInfo + * Operation cancelFuturesOrdersAsyncWithHttpInfo * - * Cancel a single order + * Cancel all `open` orders matched * * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $contract Futures contract (required) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelFuturesOrderAsyncWithHttpInfo($settle, $order_id) + public function cancelFuturesOrdersAsyncWithHttpInfo($settle, $contract, $side = null) { - $returnType = '\GateApi\Model\FuturesOrder'; - $request = $this->cancelFuturesOrderRequest($settle, $order_id); + $returnType = '\GateApi\Model\FuturesOrder[]'; + $request = $this->cancelFuturesOrdersRequest($settle, $contract, $side); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7807,36 +7899,61 @@ function ($exception) { } /** - * Create request for operation 'cancelFuturesOrder' + * Create request for operation 'cancelFuturesOrders' * * @param string $settle Settle currency (required) - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) + * @param string $contract Futures contract (required) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function cancelFuturesOrderRequest($settle, $order_id) + protected function cancelFuturesOrdersRequest($settle, $contract, $side = null) { // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling cancelFuturesOrder' + 'Missing the required parameter $settle when calling cancelFuturesOrders' ); } - // verify the required parameter 'order_id' is set - if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $order_id when calling cancelFuturesOrder' + 'Missing the required parameter $contract when calling cancelFuturesOrders' ); } - $resourcePath = '/futures/{settle}/orders/{order_id}'; + $resourcePath = '/futures/{settle}/orders'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($side !== null) { + if('form' === 'form' && is_array($side)) { + foreach($side as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['side'] = $side; + } + } + // path params if ($settle !== null) { $resourcePath = str_replace( @@ -7846,15 +7963,6 @@ protected function cancelFuturesOrderRequest($settle, $order_id) ); } - // path params - if ($order_id !== null) { - $resourcePath = str_replace( - '{' . 'order_id' . '}', - ObjectSerializer::toPathValue($order_id), - $resourcePath - ); - } - // body params $_tempBody = null; @@ -7923,52 +8031,2156 @@ protected function cancelFuturesOrderRequest($settle, $order_id) } /** - * Operation getMyTrades - * - * List personal trading history + * Operation createBatchFuturesOrder * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create a batch of futures orders * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder[] $futures_order futures_order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\MyFuturesTrade[] + * @return \GateApi\Model\BatchFuturesOrder[] */ - public function getMyTrades($associative_array) + public function createBatchFuturesOrder($settle, $futures_order) { - list($response) = $this->getMyTradesWithHttpInfo($associative_array); + list($response) = $this->createBatchFuturesOrderWithHttpInfo($settle, $futures_order); return $response; } /** - * Operation getMyTradesWithHttpInfo + * Operation createBatchFuturesOrderWithHttpInfo * - * List personal trading history + * Create a batch of futures orders * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder[] $futures_order (required) * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\BatchFuturesOrder[], HTTP status code, HTTP response headers (array of strings) + */ + public function createBatchFuturesOrderWithHttpInfo($settle, $futures_order) + { + $request = $this->createBatchFuturesOrderRequest($settle, $futures_order); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\BatchFuturesOrder[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation createBatchFuturesOrderAsync + * + * Create a batch of futures orders + * + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder[] $futures_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createBatchFuturesOrderAsync($settle, $futures_order) + { + return $this->createBatchFuturesOrderAsyncWithHttpInfo($settle, $futures_order) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createBatchFuturesOrderAsyncWithHttpInfo + * + * Create a batch of futures orders + * + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder[] $futures_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createBatchFuturesOrderAsyncWithHttpInfo($settle, $futures_order) + { + $returnType = '\GateApi\Model\BatchFuturesOrder[]'; + $request = $this->createBatchFuturesOrderRequest($settle, $futures_order); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createBatchFuturesOrder' + * + * @param string $settle Settle currency (required) + * @param \GateApi\Model\FuturesOrder[] $futures_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createBatchFuturesOrderRequest($settle, $futures_order) + { + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling createBatchFuturesOrder' + ); + } + // verify the required parameter 'futures_order' is set + if ($futures_order === null || (is_array($futures_order) && count($futures_order) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $futures_order when calling createBatchFuturesOrder' + ); + } + + $resourcePath = '/futures/{settle}/batch_orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($futures_order)) { + $_tempBody = $futures_order; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getFuturesOrder + * + * Get a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesOrder + */ + public function getFuturesOrder($settle, $order_id) + { + list($response) = $this->getFuturesOrderWithHttpInfo($settle, $order_id); + return $response; + } + + /** + * Operation getFuturesOrderWithHttpInfo + * + * Get a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FuturesOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function getFuturesOrderWithHttpInfo($settle, $order_id) + { + $request = $this->getFuturesOrderRequest($settle, $order_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FuturesOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getFuturesOrderAsync + * + * Get a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFuturesOrderAsync($settle, $order_id) + { + return $this->getFuturesOrderAsyncWithHttpInfo($settle, $order_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFuturesOrderAsyncWithHttpInfo + * + * Get a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFuturesOrderAsyncWithHttpInfo($settle, $order_id) + { + $returnType = '\GateApi\Model\FuturesOrder'; + $request = $this->getFuturesOrderRequest($settle, $order_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getFuturesOrder' + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFuturesOrderRequest($settle, $order_id) + { + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling getFuturesOrder' + ); + } + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling getFuturesOrder' + ); + } + + $resourcePath = '/futures/{settle}/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation amendFuturesOrder + * + * Amend an order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * @param \GateApi\Model\FuturesOrderAmendment $futures_order_amendment futures_order_amendment (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesOrder + */ + public function amendFuturesOrder($settle, $order_id, $futures_order_amendment) + { + list($response) = $this->amendFuturesOrderWithHttpInfo($settle, $order_id, $futures_order_amendment); + return $response; + } + + /** + * Operation amendFuturesOrderWithHttpInfo + * + * Amend an order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * @param \GateApi\Model\FuturesOrderAmendment $futures_order_amendment (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FuturesOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function amendFuturesOrderWithHttpInfo($settle, $order_id, $futures_order_amendment) + { + $request = $this->amendFuturesOrderRequest($settle, $order_id, $futures_order_amendment); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FuturesOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation amendFuturesOrderAsync + * + * Amend an order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * @param \GateApi\Model\FuturesOrderAmendment $futures_order_amendment (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function amendFuturesOrderAsync($settle, $order_id, $futures_order_amendment) + { + return $this->amendFuturesOrderAsyncWithHttpInfo($settle, $order_id, $futures_order_amendment) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation amendFuturesOrderAsyncWithHttpInfo + * + * Amend an order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * @param \GateApi\Model\FuturesOrderAmendment $futures_order_amendment (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function amendFuturesOrderAsyncWithHttpInfo($settle, $order_id, $futures_order_amendment) + { + $returnType = '\GateApi\Model\FuturesOrder'; + $request = $this->amendFuturesOrderRequest($settle, $order_id, $futures_order_amendment); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'amendFuturesOrder' + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * @param \GateApi\Model\FuturesOrderAmendment $futures_order_amendment (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function amendFuturesOrderRequest($settle, $order_id, $futures_order_amendment) + { + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling amendFuturesOrder' + ); + } + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling amendFuturesOrder' + ); + } + // verify the required parameter 'futures_order_amendment' is set + if ($futures_order_amendment === null || (is_array($futures_order_amendment) && count($futures_order_amendment) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $futures_order_amendment when calling amendFuturesOrder' + ); + } + + $resourcePath = '/futures/{settle}/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($futures_order_amendment)) { + $_tempBody = $futures_order_amendment; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('PUT', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelFuturesOrder + * + * Cancel a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesOrder + */ + public function cancelFuturesOrder($settle, $order_id) + { + list($response) = $this->cancelFuturesOrderWithHttpInfo($settle, $order_id); + return $response; + } + + /** + * Operation cancelFuturesOrderWithHttpInfo + * + * Cancel a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FuturesOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelFuturesOrderWithHttpInfo($settle, $order_id) + { + $request = $this->cancelFuturesOrderRequest($settle, $order_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FuturesOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation cancelFuturesOrderAsync + * + * Cancel a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelFuturesOrderAsync($settle, $order_id) + { + return $this->cancelFuturesOrderAsyncWithHttpInfo($settle, $order_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelFuturesOrderAsyncWithHttpInfo + * + * Cancel a single order + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelFuturesOrderAsyncWithHttpInfo($settle, $order_id) + { + $returnType = '\GateApi\Model\FuturesOrder'; + $request = $this->cancelFuturesOrderRequest($settle, $order_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelFuturesOrder' + * + * @param string $settle Settle currency (required) + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cancelFuturesOrderRequest($settle, $order_id) + { + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling cancelFuturesOrder' + ); + } + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling cancelFuturesOrder' + ); + } + + $resourcePath = '/futures/{settle}/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getMyTrades + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $order Futures order ID, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\MyFuturesTrade[] + */ + public function getMyTrades($associative_array) + { + list($response) = $this->getMyTradesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation getMyTradesWithHttpInfo + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $order Futures order ID, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\MyFuturesTrade[], HTTP status code, HTTP response headers (array of strings) + */ + public function getMyTradesWithHttpInfo($associative_array) + { + $request = $this->getMyTradesRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\MyFuturesTrade[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getMyTradesAsync + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $order Futures order ID, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMyTradesAsync($associative_array) + { + return $this->getMyTradesAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMyTradesAsyncWithHttpInfo + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $order Futures order ID, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMyTradesAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\MyFuturesTrade[]'; + $request = $this->getMyTradesRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getMyTrades' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $order Futures order ID, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getMyTradesRequest($associative_array) + { + // unbox the parameters from the associative array + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $order = array_key_exists('order', $associative_array) ? $associative_array['order'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $last_id = array_key_exists('last_id', $associative_array) ? $associative_array['last_id'] : null; + + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling getMyTrades' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.getMyTrades, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.getMyTrades, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.getMyTrades, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/futures/{settle}/my_trades'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($order !== null) { + if('form' === 'form' && is_array($order)) { + foreach($order as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['order'] = $order; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($last_id !== null) { + if('form' === 'form' && is_array($last_id)) { + foreach($last_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['last_id'] = $last_id; + } + } + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getMyTradesWithTimeRange + * + * List personal trading history by time range + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\MyFuturesTrade[] + */ + public function getMyTradesWithTimeRange($associative_array) + { + list($response) = $this->getMyTradesWithTimeRangeWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation getMyTradesWithTimeRangeWithHttpInfo + * + * List personal trading history by time range + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\MyFuturesTrade[], HTTP status code, HTTP response headers (array of strings) + */ + public function getMyTradesWithTimeRangeWithHttpInfo($associative_array) + { + $request = $this->getMyTradesWithTimeRangeRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\MyFuturesTrade[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getMyTradesWithTimeRangeAsync + * + * List personal trading history by time range + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMyTradesWithTimeRangeAsync($associative_array) + { + return $this->getMyTradesWithTimeRangeAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMyTradesWithTimeRangeAsyncWithHttpInfo + * + * List personal trading history by time range + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMyTradesWithTimeRangeAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\MyFuturesTrade[]'; + $request = $this->getMyTradesWithTimeRangeRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getMyTradesWithTimeRange' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getMyTradesWithTimeRangeRequest($associative_array) + { + // unbox the parameters from the associative array + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling getMyTradesWithTimeRange' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.getMyTradesWithTimeRange, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.getMyTradesWithTimeRange, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.getMyTradesWithTimeRange, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/futures/{settle}/my_trades_timerange'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listPositionClose + * + * List position close history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\PositionClose[] + */ + public function listPositionClose($associative_array) + { + list($response) = $this->listPositionCloseWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listPositionCloseWithHttpInfo + * + * List position close history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\PositionClose[], HTTP status code, HTTP response headers (array of strings) + */ + public function listPositionCloseWithHttpInfo($associative_array) + { + $request = $this->listPositionCloseRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\PositionClose[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listPositionCloseAsync + * + * List position close history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPositionCloseAsync($associative_array) + { + return $this->listPositionCloseAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPositionCloseAsyncWithHttpInfo + * + * List position close history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPositionCloseAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\PositionClose[]'; + $request = $this->listPositionCloseRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listPositionClose' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listPositionCloseRequest($associative_array) + { + // unbox the parameters from the associative array + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + // verify the required parameter 'settle' is set + if ($settle === null || (is_array($settle) && count($settle) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settle when calling listPositionClose' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listPositionClose, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listPositionClose, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.listPositionClose, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/futures/{settle}/position_close'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // path params + if ($settle !== null) { + $resourcePath = str_replace( + '{' . 'settle' . '}', + ObjectSerializer::toPathValue($settle), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLiquidates + * + * List liquidation history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify a liquidation timestamp (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesLiquidate[] + */ + public function listLiquidates($associative_array) + { + list($response) = $this->listLiquidatesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listLiquidatesWithHttpInfo + * + * List liquidation history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\MyFuturesTrade[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesLiquidate[], HTTP status code, HTTP response headers (array of strings) */ - public function getMyTradesWithHttpInfo($associative_array) + public function listLiquidatesWithHttpInfo($associative_array) { - $request = $this->getMyTradesRequest($associative_array); + $request = $this->listLiquidatesRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -7994,7 +10206,7 @@ public function getMyTradesWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\MyFuturesTrade[]'; + $returnType = '\GateApi\Model\FuturesLiquidate[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -8010,26 +10222,23 @@ public function getMyTradesWithHttpInfo($associative_array) } /** - * Operation getMyTradesAsync + * Operation listLiquidatesAsync * - * List personal trading history + * List liquidation history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getMyTradesAsync($associative_array) + public function listLiquidatesAsync($associative_array) { - return $this->getMyTradesAsyncWithHttpInfo($associative_array) + return $this->listLiquidatesAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -8038,27 +10247,24 @@ function ($response) { } /** - * Operation getMyTradesAsyncWithHttpInfo + * Operation listLiquidatesAsyncWithHttpInfo * - * List personal trading history + * List liquidation history * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getMyTradesAsyncWithHttpInfo($associative_array) + public function listLiquidatesAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\MyFuturesTrade[]'; - $request = $this->getMyTradesRequest($associative_array); + $returnType = '\GateApi\Model\FuturesLiquidate[]'; + $request = $this->listLiquidatesRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8095,51 +10301,41 @@ function ($exception) { } /** - * Create request for operation 'getMyTrades' + * Create request for operation 'listLiquidates' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $order Futures order ID, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param int $count_total Whether to return total number matched. Default to 0(no return) (optional, default to 0) + * @param string $settle Settle currency (required) + * @param string $contract Futures contract, return related data only if specified (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify a liquidation timestamp (optional, default to 0) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getMyTradesRequest($associative_array) + protected function listLiquidatesRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; - $order = array_key_exists('order', $associative_array) ? $associative_array['order'] : null; $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; - $last_id = array_key_exists('last_id', $associative_array) ? $associative_array['last_id'] : null; - $count_total = array_key_exists('count_total', $associative_array) ? $associative_array['count_total'] : 0; + $at = array_key_exists('at', $associative_array) ? $associative_array['at'] : 0; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling getMyTrades' + 'Missing the required parameter $settle when calling listLiquidates' ); } if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.getMyTrades, must be smaller than or equal to 1000.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidates, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.getMyTrades, must be bigger than or equal to 1.'); - } - - if ($offset !== null && $offset < 0) { - throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.getMyTrades, must be bigger than or equal to 0.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidates, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/my_trades'; + $resourcePath = '/futures/{settle}/liquidates'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8158,18 +10354,6 @@ protected function getMyTradesRequest($associative_array) } } - // query params - if ($order !== null) { - if('form' === 'form' && is_array($order)) { - foreach($order as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['order'] = $order; - } - } - // query params if ($limit !== null) { if('form' === 'form' && is_array($limit)) { @@ -8183,38 +10367,14 @@ protected function getMyTradesRequest($associative_array) } // query params - if ($offset !== null) { - if('form' === 'form' && is_array($offset)) { - foreach($offset as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['offset'] = $offset; - } - } - - // query params - if ($last_id !== null) { - if('form' === 'form' && is_array($last_id)) { - foreach($last_id as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['last_id'] = $last_id; - } - } - - // query params - if ($count_total !== null) { - if('form' === 'form' && is_array($count_total)) { - foreach($count_total as $key => $value) { + if ($at !== null) { + if('form' === 'form' && is_array($at)) { + foreach($at as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['count_total'] = $count_total; + $queryParams['at'] = $at; } } @@ -8295,46 +10455,46 @@ protected function getMyTradesRequest($associative_array) } /** - * Operation listPositionClose + * Operation listAutoDeleverages * - * List position close history + * List Auto-Deleveraging History * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify an auto-deleveraging timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\PositionClose[] + * @return \GateApi\Model\FuturesAutoDeleverage[] */ - public function listPositionClose($associative_array) + public function listAutoDeleverages($associative_array) { - list($response) = $this->listPositionCloseWithHttpInfo($associative_array); + list($response) = $this->listAutoDeleveragesWithHttpInfo($associative_array); return $response; } /** - * Operation listPositionCloseWithHttpInfo + * Operation listAutoDeleveragesWithHttpInfo * - * List position close history + * List Auto-Deleveraging History * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify an auto-deleveraging timestamp (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\PositionClose[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\FuturesAutoDeleverage[], HTTP status code, HTTP response headers (array of strings) */ - public function listPositionCloseWithHttpInfo($associative_array) + public function listAutoDeleveragesWithHttpInfo($associative_array) { - $request = $this->listPositionCloseRequest($associative_array); + $request = $this->listAutoDeleveragesRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -8360,7 +10520,7 @@ public function listPositionCloseWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\PositionClose[]'; + $returnType = '\GateApi\Model\FuturesAutoDeleverage[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -8376,23 +10536,23 @@ public function listPositionCloseWithHttpInfo($associative_array) } /** - * Operation listPositionCloseAsync + * Operation listAutoDeleveragesAsync * - * List position close history + * List Auto-Deleveraging History * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify an auto-deleveraging timestamp (optional, default to 0) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listPositionCloseAsync($associative_array) + public function listAutoDeleveragesAsync($associative_array) { - return $this->listPositionCloseAsyncWithHttpInfo($associative_array) + return $this->listAutoDeleveragesAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -8401,24 +10561,24 @@ function ($response) { } /** - * Operation listPositionCloseAsyncWithHttpInfo + * Operation listAutoDeleveragesAsyncWithHttpInfo * - * List position close history + * List Auto-Deleveraging History * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify an auto-deleveraging timestamp (optional, default to 0) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listPositionCloseAsyncWithHttpInfo($associative_array) + public function listAutoDeleveragesAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\PositionClose[]'; - $request = $this->listPositionCloseRequest($associative_array); + $returnType = '\GateApi\Model\FuturesAutoDeleverage[]'; + $request = $this->listAutoDeleveragesRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8455,45 +10615,41 @@ function ($exception) { } /** - * Create request for operation 'listPositionClose' + * Create request for operation 'listAutoDeleverages' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $at Specify an auto-deleveraging timestamp (optional, default to 0) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listPositionCloseRequest($associative_array) + protected function listAutoDeleveragesRequest($associative_array) { // unbox the parameters from the associative array $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $at = array_key_exists('at', $associative_array) ? $associative_array['at'] : 0; // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listPositionClose' + 'Missing the required parameter $settle when calling listAutoDeleverages' ); } if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listPositionClose, must be smaller than or equal to 1000.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listAutoDeleverages, must be smaller than or equal to 1000.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listPositionClose, must be bigger than or equal to 1.'); - } - - if ($offset !== null && $offset < 0) { - throw new \InvalidArgumentException('invalid value for "$offset" when calling FuturesApi.listPositionClose, must be bigger than or equal to 0.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listAutoDeleverages, must be bigger than or equal to 1.'); } - $resourcePath = '/futures/{settle}/position_close'; + $resourcePath = '/futures/{settle}/auto_deleverages'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8525,14 +10681,14 @@ protected function listPositionCloseRequest($associative_array) } // query params - if ($offset !== null) { - if('form' === 'form' && is_array($offset)) { - foreach($offset as $key => $value) { + if ($at !== null) { + if('form' === 'form' && is_array($at)) { + foreach($at as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['offset'] = $offset; + $queryParams['at'] = $at; } } @@ -8613,46 +10769,38 @@ protected function listPositionCloseRequest($associative_array) } /** - * Operation listLiquidates - * - * List liquidation history + * Operation countdownCancelAllFutures * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $at Specify a liquidation timestamp (optional, default to 0) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\CountdownCancelAllFuturesTask $countdown_cancel_all_futures_task countdown_cancel_all_futures_task (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\FuturesLiquidate[] + * @return \GateApi\Model\TriggerTime */ - public function listLiquidates($associative_array) + public function countdownCancelAllFutures($settle, $countdown_cancel_all_futures_task) { - list($response) = $this->listLiquidatesWithHttpInfo($associative_array); + list($response) = $this->countdownCancelAllFuturesWithHttpInfo($settle, $countdown_cancel_all_futures_task); return $response; } /** - * Operation listLiquidatesWithHttpInfo - * - * List liquidation history + * Operation countdownCancelAllFuturesWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $at Specify a liquidation timestamp (optional, default to 0) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\CountdownCancelAllFuturesTask $countdown_cancel_all_futures_task (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\FuturesLiquidate[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\TriggerTime, HTTP status code, HTTP response headers (array of strings) */ - public function listLiquidatesWithHttpInfo($associative_array) + public function countdownCancelAllFuturesWithHttpInfo($settle, $countdown_cancel_all_futures_task) { - $request = $this->listLiquidatesRequest($associative_array); + $request = $this->countdownCancelAllFuturesRequest($settle, $countdown_cancel_all_futures_task); $options = $this->createHttpClientOption(); try { @@ -8678,7 +10826,7 @@ public function listLiquidatesWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\FuturesLiquidate[]'; + $returnType = '\GateApi\Model\TriggerTime'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -8694,23 +10842,19 @@ public function listLiquidatesWithHttpInfo($associative_array) } /** - * Operation listLiquidatesAsync + * Operation countdownCancelAllFuturesAsync * - * List liquidation history - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $at Specify a liquidation timestamp (optional, default to 0) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\CountdownCancelAllFuturesTask $countdown_cancel_all_futures_task (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listLiquidatesAsync($associative_array) + public function countdownCancelAllFuturesAsync($settle, $countdown_cancel_all_futures_task) { - return $this->listLiquidatesAsyncWithHttpInfo($associative_array) + return $this->countdownCancelAllFuturesAsyncWithHttpInfo($settle, $countdown_cancel_all_futures_task) ->then( function ($response) { return $response[0]; @@ -8719,24 +10863,20 @@ function ($response) { } /** - * Operation listLiquidatesAsyncWithHttpInfo - * - * List liquidation history + * Operation countdownCancelAllFuturesAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $at Specify a liquidation timestamp (optional, default to 0) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\CountdownCancelAllFuturesTask $countdown_cancel_all_futures_task (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listLiquidatesAsyncWithHttpInfo($associative_array) + public function countdownCancelAllFuturesAsyncWithHttpInfo($settle, $countdown_cancel_all_futures_task) { - $returnType = '\GateApi\Model\FuturesLiquidate[]'; - $request = $this->listLiquidatesRequest($associative_array); + $returnType = '\GateApi\Model\TriggerTime'; + $request = $this->countdownCancelAllFuturesRequest($settle, $countdown_cancel_all_futures_task); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8773,83 +10913,36 @@ function ($exception) { } /** - * Create request for operation 'listLiquidates' - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create request for operation 'countdownCancelAllFutures' * - * @param string $settle Settle currency (required) - * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $at Specify a liquidation timestamp (optional, default to 0) + * @param string $settle Settle currency (required) + * @param \GateApi\Model\CountdownCancelAllFuturesTask $countdown_cancel_all_futures_task (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listLiquidatesRequest($associative_array) + protected function countdownCancelAllFuturesRequest($settle, $countdown_cancel_all_futures_task) { - // unbox the parameters from the associative array - $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; - $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $at = array_key_exists('at', $associative_array) ? $associative_array['at'] : 0; - // verify the required parameter 'settle' is set if ($settle === null || (is_array($settle) && count($settle) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $settle when calling listLiquidates' + 'Missing the required parameter $settle when calling countdownCancelAllFutures' ); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidates, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FuturesApi.listLiquidates, must be bigger than or equal to 1.'); + // verify the required parameter 'countdown_cancel_all_futures_task' is set + if ($countdown_cancel_all_futures_task === null || (is_array($countdown_cancel_all_futures_task) && count($countdown_cancel_all_futures_task) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $countdown_cancel_all_futures_task when calling countdownCancelAllFutures' + ); } - - $resourcePath = '/futures/{settle}/liquidates'; + $resourcePath = '/futures/{settle}/countdown_cancel_all'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($contract !== null) { - if('form' === 'form' && is_array($contract)) { - foreach($contract as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['contract'] = $contract; - } - } - - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - - // query params - if ($at !== null) { - if('form' === 'form' && is_array($at)) { - foreach($at as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['at'] = $at; - } - } - // path params if ($settle !== null) { $resourcePath = str_replace( @@ -8861,6 +10954,9 @@ protected function listLiquidatesRequest($associative_array) // body params $_tempBody = null; + if (isset($countdown_cancel_all_futures_task)) { + $_tempBody = $countdown_cancel_all_futures_task; + } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -8869,7 +10965,7 @@ protected function listLiquidatesRequest($associative_array) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } @@ -8903,7 +10999,7 @@ protected function listLiquidatesRequest($associative_array) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -8919,7 +11015,7 @@ protected function listLiquidatesRequest($associative_array) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -8934,9 +11030,9 @@ protected function listLiquidatesRequest($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -8957,9 +11053,9 @@ public function listPriceTriggeredOrders($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -9017,9 +11113,9 @@ public function listPriceTriggeredOrdersWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -9043,9 +11139,9 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -9096,9 +11192,9 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $settle Settle currency (required) - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $contract Futures contract, return related data only if specified (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -9788,10 +11884,10 @@ protected function cancelPriceTriggeredOrderListRequest($settle, $contract) /** * Operation getPriceTriggeredOrder * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -9806,10 +11902,10 @@ public function getPriceTriggeredOrder($settle, $order_id) /** * Operation getPriceTriggeredOrderWithHttpInfo * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -9861,10 +11957,10 @@ public function getPriceTriggeredOrderWithHttpInfo($settle, $order_id) /** * Operation getPriceTriggeredOrderAsync * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -9882,10 +11978,10 @@ function ($response) { /** * Operation getPriceTriggeredOrderAsyncWithHttpInfo * - * Get a single order + * Get a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -9933,7 +12029,7 @@ function ($exception) { * Create request for operation 'getPriceTriggeredOrder' * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -10048,10 +12144,10 @@ protected function getPriceTriggeredOrderRequest($settle, $order_id) /** * Operation cancelPriceTriggeredOrder * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -10066,10 +12162,10 @@ public function cancelPriceTriggeredOrder($settle, $order_id) /** * Operation cancelPriceTriggeredOrderWithHttpInfo * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -10121,10 +12217,10 @@ public function cancelPriceTriggeredOrderWithHttpInfo($settle, $order_id) /** * Operation cancelPriceTriggeredOrderAsync * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -10142,10 +12238,10 @@ function ($response) { /** * Operation cancelPriceTriggeredOrderAsyncWithHttpInfo * - * Cancel a single order + * cancel a price-triggered order * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -10193,7 +12289,7 @@ function ($exception) { * Create request for operation 'cancelPriceTriggeredOrder' * * @param string $settle Settle currency (required) - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request diff --git a/src/Api/MarginApi.php b/src/Api/MarginApi.php index a038b57..7ee0a90 100644 --- a/src/Api/MarginApi.php +++ b/src/Api/MarginApi.php @@ -567,7 +567,7 @@ protected function getMarginCurrencyPairRequest($currency_pair) * * Order book of lending loans * - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -584,7 +584,7 @@ public function listFundingBook($currency) * * Order book of lending loans * - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -638,7 +638,7 @@ public function listFundingBookWithHttpInfo($currency) * * Order book of lending loans * - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -658,7 +658,7 @@ function ($response) { * * Order book of lending loans * - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -705,7 +705,7 @@ function ($exception) { /** * Create request for operation 'listFundingBook' * - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1061,10 +1061,10 @@ protected function listMarginAccountsRequest($associative_array) * * @param string $currency List records related to specified currency only. If specified, `currency_pair` is also required. (optional) * @param string $currency_pair List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional) - * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $from Start timestamp of the query (optional) * @param int $to Time range ending, default to current time (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1085,10 +1085,10 @@ public function listMarginAccountBook($associative_array) * * @param string $currency List records related to specified currency only. If specified, `currency_pair` is also required. (optional) * @param string $currency_pair List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional) - * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $from Start timestamp of the query (optional) * @param int $to Time range ending, default to current time (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1146,10 +1146,10 @@ public function listMarginAccountBookWithHttpInfo($associative_array) * * @param string $currency List records related to specified currency only. If specified, `currency_pair` is also required. (optional) * @param string $currency_pair List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional) - * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $from Start timestamp of the query (optional) * @param int $to Time range ending, default to current time (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1173,10 +1173,10 @@ function ($response) { * * @param string $currency List records related to specified currency only. If specified, `currency_pair` is also required. (optional) * @param string $currency_pair List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional) - * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $from Start timestamp of the query (optional) * @param int $to Time range ending, default to current time (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1227,10 +1227,10 @@ function ($exception) { * * @param string $currency List records related to specified currency only. If specified, `currency_pair` is also required. (optional) * @param string $currency_pair List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional) - * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $from Start timestamp of the query (optional) * @param int $to Time range ending, default to current time (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1410,7 +1410,7 @@ protected function listMarginAccountBookRequest($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1429,7 +1429,7 @@ public function listFundingAccounts($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1485,7 +1485,7 @@ public function listFundingAccountsWithHttpInfo($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1507,7 +1507,7 @@ function ($response) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1556,7 +1556,7 @@ function ($exception) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1662,12 +1662,12 @@ protected function listFundingAccountsRequest($associative_array) * * @param string $status Loan status (required) * @param string $side Lend or borrow (required) - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * @param string $currency_pair Currency pair (optional) * @param string $sort_by Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) * @param bool $reverse_sort Whether to sort in descending order. Default to `true` (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1688,12 +1688,12 @@ public function listLoans($associative_array) * * @param string $status Loan status (required) * @param string $side Lend or borrow (required) - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * @param string $currency_pair Currency pair (optional) * @param string $sort_by Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) * @param bool $reverse_sort Whether to sort in descending order. Default to `true` (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1751,12 +1751,12 @@ public function listLoansWithHttpInfo($associative_array) * * @param string $status Loan status (required) * @param string $side Lend or borrow (required) - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * @param string $currency_pair Currency pair (optional) * @param string $sort_by Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) * @param bool $reverse_sort Whether to sort in descending order. Default to `true` (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1780,12 +1780,12 @@ function ($response) { * * @param string $status Loan status (required) * @param string $side Lend or borrow (required) - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * @param string $currency_pair Currency pair (optional) * @param string $sort_by Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) * @param bool $reverse_sort Whether to sort in descending order. Default to `true` (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1836,12 +1836,12 @@ function ($exception) { * * @param string $status Loan status (required) * @param string $side Lend or borrow (required) - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * @param string $currency_pair Currency pair (optional) * @param string $sort_by Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) * @param bool $reverse_sort Whether to sort in descending order. Default to `true` (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -2291,8 +2291,8 @@ protected function createLoanRequest($loan) * * Merge multiple lending loans * - * @param string $currency Retrieved specified currency related data (required) - * @param string $ids Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + * @param string $currency Retrieve data of the specified currency (required) + * @param string $ids A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -2309,8 +2309,8 @@ public function mergeLoans($currency, $ids) * * Merge multiple lending loans * - * @param string $currency Retrieved specified currency related data (required) - * @param string $ids Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + * @param string $currency Retrieve data of the specified currency (required) + * @param string $ids A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -2364,8 +2364,8 @@ public function mergeLoansWithHttpInfo($currency, $ids) * * Merge multiple lending loans * - * @param string $currency Retrieved specified currency related data (required) - * @param string $ids Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + * @param string $currency Retrieve data of the specified currency (required) + * @param string $ids A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2385,8 +2385,8 @@ function ($response) { * * Merge multiple lending loans * - * @param string $currency Retrieved specified currency related data (required) - * @param string $ids Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + * @param string $currency Retrieve data of the specified currency (required) + * @param string $ids A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2433,8 +2433,8 @@ function ($exception) { /** * Create request for operation 'mergeLoans' * - * @param string $currency Retrieved specified currency related data (required) - * @param string $ids Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + * @param string $currency Retrieve data of the specified currency (required) + * @param string $ids A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -2821,7 +2821,7 @@ protected function getLoanRequest($loan_id, $side) * Cancel lending loan * * @param string $loan_id Loan ID (required) - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -2839,7 +2839,7 @@ public function cancelLoan($loan_id, $currency) * Cancel lending loan * * @param string $loan_id Loan ID (required) - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -2894,7 +2894,7 @@ public function cancelLoanWithHttpInfo($loan_id, $currency) * Cancel lending loan * * @param string $loan_id Loan ID (required) - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2915,7 +2915,7 @@ function ($response) { * Cancel lending loan * * @param string $loan_id Loan ID (required) - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2963,7 +2963,7 @@ function ($exception) { * Create request for operation 'cancelLoan' * * @param string $loan_id Loan ID (required) - * @param string $currency Retrieved specified currency related data (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -3829,14 +3829,14 @@ protected function repayLoanRequest($loan_id, $repay_request) /** * Operation listLoanRecords * - * List repayment records of specified loan + * List repayment records of a specific loan * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $loan_id Loan ID (required) * @param string $status Loan record status (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -3851,14 +3851,14 @@ public function listLoanRecords($associative_array) /** * Operation listLoanRecordsWithHttpInfo * - * List repayment records of specified loan + * List repayment records of a specific loan * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $loan_id Loan ID (required) * @param string $status Loan record status (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -3910,14 +3910,14 @@ public function listLoanRecordsWithHttpInfo($associative_array) /** * Operation listLoanRecordsAsync * - * List repayment records of specified loan + * List repayment records of a specific loan * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $loan_id Loan ID (required) * @param string $status Loan record status (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -3935,14 +3935,14 @@ function ($response) { /** * Operation listLoanRecordsAsyncWithHttpInfo * - * List repayment records of specified loan + * List repayment records of a specific loan * * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $loan_id Loan ID (required) * @param string $status Loan record status (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -3994,7 +3994,7 @@ function ($exception) { * @param string $loan_id Loan ID (required) * @param string $status Loan record status (optional) * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -5123,32 +5123,42 @@ protected function setAutoRepayRequest($status) } /** - * Operation listCrossMarginCurrencies + * Operation getMarginTransferable * - * Currencies supported by cross margin. + * Get the max transferable amount for a specific margin currency + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginCurrency[] + * @return \GateApi\Model\MarginTransferable */ - public function listCrossMarginCurrencies() + public function getMarginTransferable($associative_array) { - list($response) = $this->listCrossMarginCurrenciesWithHttpInfo(); + list($response) = $this->getMarginTransferableWithHttpInfo($associative_array); return $response; } /** - * Operation listCrossMarginCurrenciesWithHttpInfo + * Operation getMarginTransferableWithHttpInfo * - * Currencies supported by cross margin. + * Get the max transferable amount for a specific margin currency + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginCurrency[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\MarginTransferable, HTTP status code, HTTP response headers (array of strings) */ - public function listCrossMarginCurrenciesWithHttpInfo() + public function getMarginTransferableWithHttpInfo($associative_array) { - $request = $this->listCrossMarginCurrenciesRequest(); + $request = $this->getMarginTransferableRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -5174,7 +5184,7 @@ public function listCrossMarginCurrenciesWithHttpInfo() ); } - $returnType = '\GateApi\Model\CrossMarginCurrency[]'; + $returnType = '\GateApi\Model\MarginTransferable'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5190,16 +5200,21 @@ public function listCrossMarginCurrenciesWithHttpInfo() } /** - * Operation listCrossMarginCurrenciesAsync + * Operation getMarginTransferableAsync * - * Currencies supported by cross margin. + * Get the max transferable amount for a specific margin currency + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listCrossMarginCurrenciesAsync() + public function getMarginTransferableAsync($associative_array) { - return $this->listCrossMarginCurrenciesAsyncWithHttpInfo() + return $this->getMarginTransferableAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -5208,17 +5223,22 @@ function ($response) { } /** - * Operation listCrossMarginCurrenciesAsyncWithHttpInfo + * Operation getMarginTransferableAsyncWithHttpInfo * - * Currencies supported by cross margin. + * Get the max transferable amount for a specific margin currency + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listCrossMarginCurrenciesAsyncWithHttpInfo() + public function getMarginTransferableAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\CrossMarginCurrency[]'; - $request = $this->listCrossMarginCurrenciesRequest(); + $returnType = '\GateApi\Model\MarginTransferable'; + $request = $this->getMarginTransferableRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5255,21 +5275,60 @@ function ($exception) { } /** - * Create request for operation 'listCrossMarginCurrencies' + * Create request for operation 'getMarginTransferable' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listCrossMarginCurrenciesRequest() + protected function getMarginTransferableRequest($associative_array) { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; - $resourcePath = '/margin/cross/currencies'; + // verify the required parameter 'currency' is set + if ($currency === null || (is_array($currency) && count($currency) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency when calling getMarginTransferable' + ); + } + + $resourcePath = '/margin/transferable'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + // body params $_tempBody = null; @@ -5313,6 +5372,9 @@ protected function listCrossMarginCurrenciesRequest() } } + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -5335,36 +5397,42 @@ protected function listCrossMarginCurrenciesRequest() } /** - * Operation getCrossMarginCurrency + * Operation getMarginBorrowable * - * Retrieve detail of one single currency supported by cross margin + * Get the max borrowable amount for a specific margin currency * - * @param string $currency Currency name (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginCurrency + * @return \GateApi\Model\MarginBorrowable */ - public function getCrossMarginCurrency($currency) + public function getMarginBorrowable($associative_array) { - list($response) = $this->getCrossMarginCurrencyWithHttpInfo($currency); + list($response) = $this->getMarginBorrowableWithHttpInfo($associative_array); return $response; } /** - * Operation getCrossMarginCurrencyWithHttpInfo + * Operation getMarginBorrowableWithHttpInfo * - * Retrieve detail of one single currency supported by cross margin + * Get the max borrowable amount for a specific margin currency * - * @param string $currency Currency name (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginCurrency, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\MarginBorrowable, HTTP status code, HTTP response headers (array of strings) */ - public function getCrossMarginCurrencyWithHttpInfo($currency) + public function getMarginBorrowableWithHttpInfo($associative_array) { - $request = $this->getCrossMarginCurrencyRequest($currency); + $request = $this->getMarginBorrowableRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -5390,7 +5458,7 @@ public function getCrossMarginCurrencyWithHttpInfo($currency) ); } - $returnType = '\GateApi\Model\CrossMarginCurrency'; + $returnType = '\GateApi\Model\MarginBorrowable'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5406,18 +5474,21 @@ public function getCrossMarginCurrencyWithHttpInfo($currency) } /** - * Operation getCrossMarginCurrencyAsync + * Operation getMarginBorrowableAsync * - * Retrieve detail of one single currency supported by cross margin + * Get the max borrowable amount for a specific margin currency * - * @param string $currency Currency name (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getCrossMarginCurrencyAsync($currency) + public function getMarginBorrowableAsync($associative_array) { - return $this->getCrossMarginCurrencyAsyncWithHttpInfo($currency) + return $this->getMarginBorrowableAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -5426,19 +5497,22 @@ function ($response) { } /** - * Operation getCrossMarginCurrencyAsyncWithHttpInfo + * Operation getMarginBorrowableAsyncWithHttpInfo * - * Retrieve detail of one single currency supported by cross margin + * Get the max borrowable amount for a specific margin currency * - * @param string $currency Currency name (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getCrossMarginCurrencyAsyncWithHttpInfo($currency) + public function getMarginBorrowableAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\CrossMarginCurrency'; - $request = $this->getCrossMarginCurrencyRequest($currency); + $returnType = '\GateApi\Model\MarginBorrowable'; + $request = $this->getMarginBorrowableRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5475,36 +5549,58 @@ function ($exception) { } /** - * Create request for operation 'getCrossMarginCurrency' + * Create request for operation 'getMarginBorrowable' * - * @param string $currency Currency name (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (required) + * @param string $currency_pair Currency pair (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCrossMarginCurrencyRequest($currency) + protected function getMarginBorrowableRequest($associative_array) { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; + // verify the required parameter 'currency' is set if ($currency === null || (is_array($currency) && count($currency) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $currency when calling getCrossMarginCurrency' + 'Missing the required parameter $currency when calling getMarginBorrowable' ); } - $resourcePath = '/margin/cross/currencies/{currency}'; + $resourcePath = '/margin/borrowable'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // path params + // query params if ($currency !== null) { - $resourcePath = str_replace( - '{' . 'currency' . '}', - ObjectSerializer::toPathValue($currency), - $resourcePath - ); + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } } // body params @@ -5550,6 +5646,9 @@ protected function getCrossMarginCurrencyRequest($currency) } } + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -5572,32 +5671,32 @@ protected function getCrossMarginCurrencyRequest($currency) } /** - * Operation getCrossMarginAccount + * Operation listCrossMarginCurrencies * - * Retrieve cross margin account + * Currencies supported by cross margin. * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginAccount + * @return \GateApi\Model\CrossMarginCurrency[] */ - public function getCrossMarginAccount() + public function listCrossMarginCurrencies() { - list($response) = $this->getCrossMarginAccountWithHttpInfo(); + list($response) = $this->listCrossMarginCurrenciesWithHttpInfo(); return $response; } /** - * Operation getCrossMarginAccountWithHttpInfo + * Operation listCrossMarginCurrenciesWithHttpInfo * - * Retrieve cross margin account + * Currencies supported by cross margin. * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginAccount, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\CrossMarginCurrency[], HTTP status code, HTTP response headers (array of strings) */ - public function getCrossMarginAccountWithHttpInfo() + public function listCrossMarginCurrenciesWithHttpInfo() { - $request = $this->getCrossMarginAccountRequest(); + $request = $this->listCrossMarginCurrenciesRequest(); $options = $this->createHttpClientOption(); try { @@ -5623,7 +5722,7 @@ public function getCrossMarginAccountWithHttpInfo() ); } - $returnType = '\GateApi\Model\CrossMarginAccount'; + $returnType = '\GateApi\Model\CrossMarginCurrency[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5639,16 +5738,16 @@ public function getCrossMarginAccountWithHttpInfo() } /** - * Operation getCrossMarginAccountAsync + * Operation listCrossMarginCurrenciesAsync * - * Retrieve cross margin account + * Currencies supported by cross margin. * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getCrossMarginAccountAsync() + public function listCrossMarginCurrenciesAsync() { - return $this->getCrossMarginAccountAsyncWithHttpInfo() + return $this->listCrossMarginCurrenciesAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -5657,17 +5756,17 @@ function ($response) { } /** - * Operation getCrossMarginAccountAsyncWithHttpInfo + * Operation listCrossMarginCurrenciesAsyncWithHttpInfo * - * Retrieve cross margin account + * Currencies supported by cross margin. * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getCrossMarginAccountAsyncWithHttpInfo() + public function listCrossMarginCurrenciesAsyncWithHttpInfo() { - $returnType = '\GateApi\Model\CrossMarginAccount'; - $request = $this->getCrossMarginAccountRequest(); + $returnType = '\GateApi\Model\CrossMarginCurrency[]'; + $request = $this->listCrossMarginCurrenciesRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5704,15 +5803,15 @@ function ($exception) { } /** - * Create request for operation 'getCrossMarginAccount' + * Create request for operation 'listCrossMarginCurrencies' * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCrossMarginAccountRequest() + protected function listCrossMarginCurrenciesRequest() { - $resourcePath = '/margin/cross/accounts'; + $resourcePath = '/margin/cross/currencies'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5762,9 +5861,6 @@ protected function getCrossMarginAccountRequest() } } - // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); - $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -5787,48 +5883,36 @@ protected function getCrossMarginAccountRequest() } /** - * Operation listCrossMarginLoans - * - * List cross margin borrow history + * Operation getCrossMarginCurrency * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Retrieve detail of one single currency supported by cross margin * - * @param int $status Filter by status. Supported values are 2 and 3. (required) - * @param string $currency Filter by currency (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Currency name (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginLoan[] + * @return \GateApi\Model\CrossMarginCurrency */ - public function listCrossMarginLoans($associative_array) + public function getCrossMarginCurrency($currency) { - list($response) = $this->listCrossMarginLoansWithHttpInfo($associative_array); + list($response) = $this->getCrossMarginCurrencyWithHttpInfo($currency); return $response; } /** - * Operation listCrossMarginLoansWithHttpInfo - * - * List cross margin borrow history + * Operation getCrossMarginCurrencyWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Retrieve detail of one single currency supported by cross margin * - * @param int $status Filter by status. Supported values are 2 and 3. (required) - * @param string $currency Filter by currency (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Currency name (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginLoan[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\CrossMarginCurrency, HTTP status code, HTTP response headers (array of strings) */ - public function listCrossMarginLoansWithHttpInfo($associative_array) + public function getCrossMarginCurrencyWithHttpInfo($currency) { - $request = $this->listCrossMarginLoansRequest($associative_array); + $request = $this->getCrossMarginCurrencyRequest($currency); $options = $this->createHttpClientOption(); try { @@ -5854,7 +5938,7 @@ public function listCrossMarginLoansWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\CrossMarginLoan[]'; + $returnType = '\GateApi\Model\CrossMarginCurrency'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -5870,24 +5954,18 @@ public function listCrossMarginLoansWithHttpInfo($associative_array) } /** - * Operation listCrossMarginLoansAsync - * - * List cross margin borrow history + * Operation getCrossMarginCurrencyAsync * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Retrieve detail of one single currency supported by cross margin * - * @param int $status Filter by status. Supported values are 2 and 3. (required) - * @param string $currency Filter by currency (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Currency name (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listCrossMarginLoansAsync($associative_array) + public function getCrossMarginCurrencyAsync($currency) { - return $this->listCrossMarginLoansAsyncWithHttpInfo($associative_array) + return $this->getCrossMarginCurrencyAsyncWithHttpInfo($currency) ->then( function ($response) { return $response[0]; @@ -5896,25 +5974,19 @@ function ($response) { } /** - * Operation listCrossMarginLoansAsyncWithHttpInfo - * - * List cross margin borrow history + * Operation getCrossMarginCurrencyAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Retrieve detail of one single currency supported by cross margin * - * @param int $status Filter by status. Supported values are 2 and 3. (required) - * @param string $currency Filter by currency (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Currency name (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listCrossMarginLoansAsyncWithHttpInfo($associative_array) + public function getCrossMarginCurrencyAsyncWithHttpInfo($currency) { - $returnType = '\GateApi\Model\CrossMarginLoan[]'; - $request = $this->listCrossMarginLoansRequest($associative_array); + $returnType = '\GateApi\Model\CrossMarginCurrency'; + $request = $this->getCrossMarginCurrencyRequest($currency); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5951,111 +6023,36 @@ function ($exception) { } /** - * Create request for operation 'listCrossMarginLoans' - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create request for operation 'getCrossMarginCurrency' * - * @param int $status Filter by status. Supported values are 2 and 3. (required) - * @param string $currency Filter by currency (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Currency name (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listCrossMarginLoansRequest($associative_array) + protected function getCrossMarginCurrencyRequest($currency) { - // unbox the parameters from the associative array - $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; - $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; - $reverse = array_key_exists('reverse', $associative_array) ? $associative_array['reverse'] : true; - - // verify the required parameter 'status' is set - if ($status === null || (is_array($status) && count($status) === 0)) { + // verify the required parameter 'currency' is set + if ($currency === null || (is_array($currency) && count($currency) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $status when calling listCrossMarginLoans' + 'Missing the required parameter $currency when calling getCrossMarginCurrency' ); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginLoans, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginLoans, must be bigger than or equal to 1.'); - } - if ($offset !== null && $offset < 0) { - throw new \InvalidArgumentException('invalid value for "$offset" when calling MarginApi.listCrossMarginLoans, must be bigger than or equal to 0.'); - } - - - $resourcePath = '/margin/cross/loans'; + $resourcePath = '/margin/cross/currencies/{currency}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($status !== null) { - if('form' === 'form' && is_array($status)) { - foreach($status as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['status'] = $status; - } - } - - // query params + // path params if ($currency !== null) { - if('form' === 'form' && is_array($currency)) { - foreach($currency as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['currency'] = $currency; - } - } - - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - - // query params - if ($offset !== null) { - if('form' === 'form' && is_array($offset)) { - foreach($offset as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['offset'] = $offset; - } - } - - // query params - if ($reverse !== null) { - if('form' === 'form' && is_array($reverse)) { - foreach($reverse as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['reverse'] = $reverse; - } + $resourcePath = str_replace( + '{' . 'currency' . '}', + ObjectSerializer::toPathValue($currency), + $resourcePath + ); } // body params @@ -6101,9 +6098,6 @@ protected function listCrossMarginLoansRequest($associative_array) } } - // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); - $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -6126,36 +6120,32 @@ protected function listCrossMarginLoansRequest($associative_array) } /** - * Operation createCrossMarginLoan - * - * Create a cross margin borrow loan + * Operation getCrossMarginAccount * - * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan cross_margin_loan (required) + * Retrieve cross margin account * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginLoan + * @return \GateApi\Model\CrossMarginAccount */ - public function createCrossMarginLoan($cross_margin_loan) + public function getCrossMarginAccount() { - list($response) = $this->createCrossMarginLoanWithHttpInfo($cross_margin_loan); + list($response) = $this->getCrossMarginAccountWithHttpInfo(); return $response; } /** - * Operation createCrossMarginLoanWithHttpInfo - * - * Create a cross margin borrow loan + * Operation getCrossMarginAccountWithHttpInfo * - * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * Retrieve cross margin account * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginLoan, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\CrossMarginAccount, HTTP status code, HTTP response headers (array of strings) */ - public function createCrossMarginLoanWithHttpInfo($cross_margin_loan) + public function getCrossMarginAccountWithHttpInfo() { - $request = $this->createCrossMarginLoanRequest($cross_margin_loan); + $request = $this->getCrossMarginAccountRequest(); $options = $this->createHttpClientOption(); try { @@ -6181,7 +6171,7 @@ public function createCrossMarginLoanWithHttpInfo($cross_margin_loan) ); } - $returnType = '\GateApi\Model\CrossMarginLoan'; + $returnType = '\GateApi\Model\CrossMarginAccount'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -6197,18 +6187,16 @@ public function createCrossMarginLoanWithHttpInfo($cross_margin_loan) } /** - * Operation createCrossMarginLoanAsync - * - * Create a cross margin borrow loan + * Operation getCrossMarginAccountAsync * - * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * Retrieve cross margin account * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createCrossMarginLoanAsync($cross_margin_loan) + public function getCrossMarginAccountAsync() { - return $this->createCrossMarginLoanAsyncWithHttpInfo($cross_margin_loan) + return $this->getCrossMarginAccountAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -6217,19 +6205,17 @@ function ($response) { } /** - * Operation createCrossMarginLoanAsyncWithHttpInfo - * - * Create a cross margin borrow loan + * Operation getCrossMarginAccountAsyncWithHttpInfo * - * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * Retrieve cross margin account * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createCrossMarginLoanAsyncWithHttpInfo($cross_margin_loan) + public function getCrossMarginAccountAsyncWithHttpInfo() { - $returnType = '\GateApi\Model\CrossMarginLoan'; - $request = $this->createCrossMarginLoanRequest($cross_margin_loan); + $returnType = '\GateApi\Model\CrossMarginAccount'; + $request = $this->getCrossMarginAccountRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6266,23 +6252,15 @@ function ($exception) { } /** - * Create request for operation 'createCrossMarginLoan' - * - * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * Create request for operation 'getCrossMarginAccount' * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createCrossMarginLoanRequest($cross_margin_loan) + protected function getCrossMarginAccountRequest() { - // verify the required parameter 'cross_margin_loan' is set - if ($cross_margin_loan === null || (is_array($cross_margin_loan) && count($cross_margin_loan) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $cross_margin_loan when calling createCrossMarginLoan' - ); - } - $resourcePath = '/margin/cross/loans'; + $resourcePath = '/margin/cross/accounts'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6291,10 +6269,1504 @@ protected function createCrossMarginLoanRequest($cross_margin_loan) // body params $_tempBody = null; - if (isset($cross_margin_loan)) { - $_tempBody = $cross_margin_loan; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } } + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCrossMarginAccountBook + * + * Retrieve cross margin account change history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $type Only retrieve changes of the specified type. All types will be returned if not specified. (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CrossMarginAccountBook[] + */ + public function listCrossMarginAccountBook($associative_array) + { + list($response) = $this->listCrossMarginAccountBookWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listCrossMarginAccountBookWithHttpInfo + * + * Retrieve cross margin account change history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $type Only retrieve changes of the specified type. All types will be returned if not specified. (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CrossMarginAccountBook[], HTTP status code, HTTP response headers (array of strings) + */ + public function listCrossMarginAccountBookWithHttpInfo($associative_array) + { + $request = $this->listCrossMarginAccountBookRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CrossMarginAccountBook[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listCrossMarginAccountBookAsync + * + * Retrieve cross margin account change history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $type Only retrieve changes of the specified type. All types will be returned if not specified. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCrossMarginAccountBookAsync($associative_array) + { + return $this->listCrossMarginAccountBookAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCrossMarginAccountBookAsyncWithHttpInfo + * + * Retrieve cross margin account change history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $type Only retrieve changes of the specified type. All types will be returned if not specified. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCrossMarginAccountBookAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\CrossMarginAccountBook[]'; + $request = $this->listCrossMarginAccountBookRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCrossMarginAccountBook' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param string $type Only retrieve changes of the specified type. All types will be returned if not specified. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listCrossMarginAccountBookRequest($associative_array) + { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $type = array_key_exists('type', $associative_array) ? $associative_array['type'] : null; + + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling MarginApi.listCrossMarginAccountBook, must be bigger than or equal to 1.'); + } + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginAccountBook, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginAccountBook, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/margin/cross/account_book'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($page !== null) { + if('form' === 'form' && is_array($page)) { + foreach($page as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['page'] = $page; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($type !== null) { + if('form' === 'form' && is_array($type)) { + foreach($type as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['type'] = $type; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCrossMarginLoans + * + * List cross margin borrow history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Filter by status. Supported values are 2 and 3. (required) + * @param string $currency Filter by currency (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CrossMarginLoan[] + */ + public function listCrossMarginLoans($associative_array) + { + list($response) = $this->listCrossMarginLoansWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listCrossMarginLoansWithHttpInfo + * + * List cross margin borrow history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Filter by status. Supported values are 2 and 3. (required) + * @param string $currency Filter by currency (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CrossMarginLoan[], HTTP status code, HTTP response headers (array of strings) + */ + public function listCrossMarginLoansWithHttpInfo($associative_array) + { + $request = $this->listCrossMarginLoansRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CrossMarginLoan[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listCrossMarginLoansAsync + * + * List cross margin borrow history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Filter by status. Supported values are 2 and 3. (required) + * @param string $currency Filter by currency (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCrossMarginLoansAsync($associative_array) + { + return $this->listCrossMarginLoansAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCrossMarginLoansAsyncWithHttpInfo + * + * List cross margin borrow history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Filter by status. Supported values are 2 and 3. (required) + * @param string $currency Filter by currency (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCrossMarginLoansAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\CrossMarginLoan[]'; + $request = $this->listCrossMarginLoansRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCrossMarginLoans' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $status Filter by status. Supported values are 2 and 3. (required) + * @param string $currency Filter by currency (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listCrossMarginLoansRequest($associative_array) + { + // unbox the parameters from the associative array + $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $reverse = array_key_exists('reverse', $associative_array) ? $associative_array['reverse'] : true; + + // verify the required parameter 'status' is set + if ($status === null || (is_array($status) && count($status) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling listCrossMarginLoans' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginLoans, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginLoans, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling MarginApi.listCrossMarginLoans, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/margin/cross/loans'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($status !== null) { + if('form' === 'form' && is_array($status)) { + foreach($status as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['status'] = $status; + } + } + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($reverse !== null) { + if('form' === 'form' && is_array($reverse)) { + foreach($reverse as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['reverse'] = $reverse; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createCrossMarginLoan + * + * Create a cross margin borrow loan + * + * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan cross_margin_loan (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CrossMarginLoan + */ + public function createCrossMarginLoan($cross_margin_loan) + { + list($response) = $this->createCrossMarginLoanWithHttpInfo($cross_margin_loan); + return $response; + } + + /** + * Operation createCrossMarginLoanWithHttpInfo + * + * Create a cross margin borrow loan + * + * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CrossMarginLoan, HTTP status code, HTTP response headers (array of strings) + */ + public function createCrossMarginLoanWithHttpInfo($cross_margin_loan) + { + $request = $this->createCrossMarginLoanRequest($cross_margin_loan); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CrossMarginLoan'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation createCrossMarginLoanAsync + * + * Create a cross margin borrow loan + * + * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCrossMarginLoanAsync($cross_margin_loan) + { + return $this->createCrossMarginLoanAsyncWithHttpInfo($cross_margin_loan) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createCrossMarginLoanAsyncWithHttpInfo + * + * Create a cross margin borrow loan + * + * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCrossMarginLoanAsyncWithHttpInfo($cross_margin_loan) + { + $returnType = '\GateApi\Model\CrossMarginLoan'; + $request = $this->createCrossMarginLoanRequest($cross_margin_loan); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createCrossMarginLoan' + * + * @param \GateApi\Model\CrossMarginLoan $cross_margin_loan (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createCrossMarginLoanRequest($cross_margin_loan) + { + // verify the required parameter 'cross_margin_loan' is set + if ($cross_margin_loan === null || (is_array($cross_margin_loan) && count($cross_margin_loan) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $cross_margin_loan when calling createCrossMarginLoan' + ); + } + + $resourcePath = '/margin/cross/loans'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($cross_margin_loan)) { + $_tempBody = $cross_margin_loan; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getCrossMarginLoan + * + * Retrieve single borrow loan detail + * + * @param string $loan_id Borrow loan ID (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CrossMarginLoan + */ + public function getCrossMarginLoan($loan_id) + { + list($response) = $this->getCrossMarginLoanWithHttpInfo($loan_id); + return $response; + } + + /** + * Operation getCrossMarginLoanWithHttpInfo + * + * Retrieve single borrow loan detail + * + * @param string $loan_id Borrow loan ID (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CrossMarginLoan, HTTP status code, HTTP response headers (array of strings) + */ + public function getCrossMarginLoanWithHttpInfo($loan_id) + { + $request = $this->getCrossMarginLoanRequest($loan_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CrossMarginLoan'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getCrossMarginLoanAsync + * + * Retrieve single borrow loan detail + * + * @param string $loan_id Borrow loan ID (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCrossMarginLoanAsync($loan_id) + { + return $this->getCrossMarginLoanAsyncWithHttpInfo($loan_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCrossMarginLoanAsyncWithHttpInfo + * + * Retrieve single borrow loan detail + * + * @param string $loan_id Borrow loan ID (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCrossMarginLoanAsyncWithHttpInfo($loan_id) + { + $returnType = '\GateApi\Model\CrossMarginLoan'; + $request = $this->getCrossMarginLoanRequest($loan_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getCrossMarginLoan' + * + * @param string $loan_id Borrow loan ID (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getCrossMarginLoanRequest($loan_id) + { + // verify the required parameter 'loan_id' is set + if ($loan_id === null || (is_array($loan_id) && count($loan_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $loan_id when calling getCrossMarginLoan' + ); + } + + $resourcePath = '/margin/cross/loans/{loan_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($loan_id !== null) { + $resourcePath = str_replace( + '{' . 'loan_id' . '}', + ObjectSerializer::toPathValue($loan_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCrossMarginRepayments + * + * Retrieve cross margin repayments + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency currency (optional) + * @param string $loan_id loan_id (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CrossMarginRepayment[] + */ + public function listCrossMarginRepayments($associative_array) + { + list($response) = $this->listCrossMarginRepaymentsWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listCrossMarginRepaymentsWithHttpInfo + * + * Retrieve cross margin repayments + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency (optional) + * @param string $loan_id (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CrossMarginRepayment[], HTTP status code, HTTP response headers (array of strings) + */ + public function listCrossMarginRepaymentsWithHttpInfo($associative_array) + { + $request = $this->listCrossMarginRepaymentsRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CrossMarginRepayment[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listCrossMarginRepaymentsAsync + * + * Retrieve cross margin repayments + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency (optional) + * @param string $loan_id (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCrossMarginRepaymentsAsync($associative_array) + { + return $this->listCrossMarginRepaymentsAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCrossMarginRepaymentsAsyncWithHttpInfo + * + * Retrieve cross margin repayments + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency (optional) + * @param string $loan_id (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCrossMarginRepaymentsAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\CrossMarginRepayment[]'; + $request = $this->listCrossMarginRepaymentsRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCrossMarginRepayments' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency (optional) + * @param string $loan_id (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listCrossMarginRepaymentsRequest($associative_array) + { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $loan_id = array_key_exists('loan_id', $associative_array) ? $associative_array['loan_id'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $reverse = array_key_exists('reverse', $associative_array) ? $associative_array['reverse'] : true; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginRepayments, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginRepayments, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling MarginApi.listCrossMarginRepayments, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/margin/cross/repayments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($loan_id !== null) { + if('form' === 'form' && is_array($loan_id)) { + foreach($loan_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['loan_id'] = $loan_id; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($reverse !== null) { + if('form' === 'form' && is_array($reverse)) { + foreach($reverse as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['reverse'] = $reverse; + } + } + + // body params + $_tempBody = null; + if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/json'] @@ -6302,7 +7774,7 @@ protected function createCrossMarginLoanRequest($cross_margin_loan) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } @@ -6336,7 +7808,7 @@ protected function createCrossMarginLoanRequest($cross_margin_loan) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -6352,7 +7824,7 @@ protected function createCrossMarginLoanRequest($cross_margin_loan) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -6360,36 +7832,36 @@ protected function createCrossMarginLoanRequest($cross_margin_loan) } /** - * Operation getCrossMarginLoan + * Operation repayCrossMarginLoan * - * Retrieve single borrow loan detail + * Cross margin repayments * - * @param string $loan_id Borrow loan ID (required) + * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request cross_margin_repay_request (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginLoan + * @return \GateApi\Model\CrossMarginLoan[] */ - public function getCrossMarginLoan($loan_id) + public function repayCrossMarginLoan($cross_margin_repay_request) { - list($response) = $this->getCrossMarginLoanWithHttpInfo($loan_id); + list($response) = $this->repayCrossMarginLoanWithHttpInfo($cross_margin_repay_request); return $response; } /** - * Operation getCrossMarginLoanWithHttpInfo + * Operation repayCrossMarginLoanWithHttpInfo * - * Retrieve single borrow loan detail + * Cross margin repayments * - * @param string $loan_id Borrow loan ID (required) + * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginLoan, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\CrossMarginLoan[], HTTP status code, HTTP response headers (array of strings) */ - public function getCrossMarginLoanWithHttpInfo($loan_id) + public function repayCrossMarginLoanWithHttpInfo($cross_margin_repay_request) { - $request = $this->getCrossMarginLoanRequest($loan_id); + $request = $this->repayCrossMarginLoanRequest($cross_margin_repay_request); $options = $this->createHttpClientOption(); try { @@ -6415,7 +7887,7 @@ public function getCrossMarginLoanWithHttpInfo($loan_id) ); } - $returnType = '\GateApi\Model\CrossMarginLoan'; + $returnType = '\GateApi\Model\CrossMarginLoan[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -6431,18 +7903,18 @@ public function getCrossMarginLoanWithHttpInfo($loan_id) } /** - * Operation getCrossMarginLoanAsync + * Operation repayCrossMarginLoanAsync * - * Retrieve single borrow loan detail + * Cross margin repayments * - * @param string $loan_id Borrow loan ID (required) + * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getCrossMarginLoanAsync($loan_id) + public function repayCrossMarginLoanAsync($cross_margin_repay_request) { - return $this->getCrossMarginLoanAsyncWithHttpInfo($loan_id) + return $this->repayCrossMarginLoanAsyncWithHttpInfo($cross_margin_repay_request) ->then( function ($response) { return $response[0]; @@ -6451,19 +7923,19 @@ function ($response) { } /** - * Operation getCrossMarginLoanAsyncWithHttpInfo + * Operation repayCrossMarginLoanAsyncWithHttpInfo * - * Retrieve single borrow loan detail + * Cross margin repayments * - * @param string $loan_id Borrow loan ID (required) + * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getCrossMarginLoanAsyncWithHttpInfo($loan_id) + public function repayCrossMarginLoanAsyncWithHttpInfo($cross_margin_repay_request) { - $returnType = '\GateApi\Model\CrossMarginLoan'; - $request = $this->getCrossMarginLoanRequest($loan_id); + $returnType = '\GateApi\Model\CrossMarginLoan[]'; + $request = $this->repayCrossMarginLoanRequest($cross_margin_repay_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6500,40 +7972,34 @@ function ($exception) { } /** - * Create request for operation 'getCrossMarginLoan' + * Create request for operation 'repayCrossMarginLoan' * - * @param string $loan_id Borrow loan ID (required) + * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getCrossMarginLoanRequest($loan_id) + protected function repayCrossMarginLoanRequest($cross_margin_repay_request) { - // verify the required parameter 'loan_id' is set - if ($loan_id === null || (is_array($loan_id) && count($loan_id) === 0)) { + // verify the required parameter 'cross_margin_repay_request' is set + if ($cross_margin_repay_request === null || (is_array($cross_margin_repay_request) && count($cross_margin_repay_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $loan_id when calling getCrossMarginLoan' + 'Missing the required parameter $cross_margin_repay_request when calling repayCrossMarginLoan' ); } - $resourcePath = '/margin/cross/loans/{loan_id}'; + $resourcePath = '/margin/cross/repayments'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // path params - if ($loan_id !== null) { - $resourcePath = str_replace( - '{' . 'loan_id' . '}', - ObjectSerializer::toPathValue($loan_id), - $resourcePath - ); - } - // body params $_tempBody = null; + if (isset($cross_margin_repay_request)) { + $_tempBody = $cross_margin_repay_request; + } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -6542,7 +8008,7 @@ protected function getCrossMarginLoanRequest($loan_id) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } @@ -6576,7 +8042,7 @@ protected function getCrossMarginLoanRequest($loan_id) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -6592,7 +8058,7 @@ protected function getCrossMarginLoanRequest($loan_id) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -6600,48 +8066,36 @@ protected function getCrossMarginLoanRequest($loan_id) } /** - * Operation listCrossMarginRepayments - * - * Retrieve cross margin repayments + * Operation getCrossMarginTransferable * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Get the max transferable amount for a specific cross margin currency * - * @param string $currency currency (optional) - * @param string $loan_id loan_id (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginRepayment[] + * @return \GateApi\Model\CrossMarginTransferable */ - public function listCrossMarginRepayments($associative_array) + public function getCrossMarginTransferable($currency) { - list($response) = $this->listCrossMarginRepaymentsWithHttpInfo($associative_array); + list($response) = $this->getCrossMarginTransferableWithHttpInfo($currency); return $response; } /** - * Operation listCrossMarginRepaymentsWithHttpInfo + * Operation getCrossMarginTransferableWithHttpInfo * - * Retrieve cross margin repayments - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Get the max transferable amount for a specific cross margin currency * - * @param string $currency (optional) - * @param string $loan_id (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginRepayment[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\CrossMarginTransferable, HTTP status code, HTTP response headers (array of strings) */ - public function listCrossMarginRepaymentsWithHttpInfo($associative_array) + public function getCrossMarginTransferableWithHttpInfo($currency) { - $request = $this->listCrossMarginRepaymentsRequest($associative_array); + $request = $this->getCrossMarginTransferableRequest($currency); $options = $this->createHttpClientOption(); try { @@ -6667,7 +8121,7 @@ public function listCrossMarginRepaymentsWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\CrossMarginRepayment[]'; + $returnType = '\GateApi\Model\CrossMarginTransferable'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -6683,24 +8137,18 @@ public function listCrossMarginRepaymentsWithHttpInfo($associative_array) } /** - * Operation listCrossMarginRepaymentsAsync + * Operation getCrossMarginTransferableAsync * - * Retrieve cross margin repayments - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Get the max transferable amount for a specific cross margin currency * - * @param string $currency (optional) - * @param string $loan_id (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listCrossMarginRepaymentsAsync($associative_array) + public function getCrossMarginTransferableAsync($currency) { - return $this->listCrossMarginRepaymentsAsyncWithHttpInfo($associative_array) + return $this->getCrossMarginTransferableAsyncWithHttpInfo($currency) ->then( function ($response) { return $response[0]; @@ -6709,25 +8157,19 @@ function ($response) { } /** - * Operation listCrossMarginRepaymentsAsyncWithHttpInfo - * - * Retrieve cross margin repayments + * Operation getCrossMarginTransferableAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Get the max transferable amount for a specific cross margin currency * - * @param string $currency (optional) - * @param string $loan_id (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listCrossMarginRepaymentsAsyncWithHttpInfo($associative_array) + public function getCrossMarginTransferableAsyncWithHttpInfo($currency) { - $returnType = '\GateApi\Model\CrossMarginRepayment[]'; - $request = $this->listCrossMarginRepaymentsRequest($associative_array); + $returnType = '\GateApi\Model\CrossMarginTransferable'; + $request = $this->getCrossMarginTransferableRequest($currency); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6764,41 +8206,23 @@ function ($exception) { } /** - * Create request for operation 'listCrossMarginRepayments' - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create request for operation 'getCrossMarginTransferable' * - * @param string $currency (optional) - * @param string $loan_id (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $offset List offset, starting from 0 (optional, default to 0) - * @param bool $reverse Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional, default to true) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listCrossMarginRepaymentsRequest($associative_array) + protected function getCrossMarginTransferableRequest($currency) { - // unbox the parameters from the associative array - $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; - $loan_id = array_key_exists('loan_id', $associative_array) ? $associative_array['loan_id'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; - $reverse = array_key_exists('reverse', $associative_array) ? $associative_array['reverse'] : true; - - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginRepayments, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling MarginApi.listCrossMarginRepayments, must be bigger than or equal to 1.'); - } - - if ($offset !== null && $offset < 0) { - throw new \InvalidArgumentException('invalid value for "$offset" when calling MarginApi.listCrossMarginRepayments, must be bigger than or equal to 0.'); + // verify the required parameter 'currency' is set + if ($currency === null || (is_array($currency) && count($currency) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency when calling getCrossMarginTransferable' + ); } - - $resourcePath = '/margin/cross/repayments'; + $resourcePath = '/margin/cross/transferable'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6817,54 +8241,6 @@ protected function listCrossMarginRepaymentsRequest($associative_array) } } - // query params - if ($loan_id !== null) { - if('form' === 'form' && is_array($loan_id)) { - foreach($loan_id as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['loan_id'] = $loan_id; - } - } - - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - - // query params - if ($offset !== null) { - if('form' === 'form' && is_array($offset)) { - foreach($offset as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['offset'] = $offset; - } - } - - // query params - if ($reverse !== null) { - if('form' === 'form' && is_array($reverse)) { - foreach($reverse as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['reverse'] = $reverse; - } - } - // body params $_tempBody = null; @@ -6933,36 +8309,36 @@ protected function listCrossMarginRepaymentsRequest($associative_array) } /** - * Operation repayCrossMarginLoan + * Operation getCrossMarginBorrowable * - * Repay cross margin loan + * Get the max borrowable amount for a specific cross margin currency * - * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request cross_margin_repay_request (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CrossMarginLoan[] + * @return \GateApi\Model\CrossMarginBorrowable */ - public function repayCrossMarginLoan($cross_margin_repay_request) + public function getCrossMarginBorrowable($currency) { - list($response) = $this->repayCrossMarginLoanWithHttpInfo($cross_margin_repay_request); + list($response) = $this->getCrossMarginBorrowableWithHttpInfo($currency); return $response; } /** - * Operation repayCrossMarginLoanWithHttpInfo + * Operation getCrossMarginBorrowableWithHttpInfo * - * Repay cross margin loan + * Get the max borrowable amount for a specific cross margin currency * - * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CrossMarginLoan[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\CrossMarginBorrowable, HTTP status code, HTTP response headers (array of strings) */ - public function repayCrossMarginLoanWithHttpInfo($cross_margin_repay_request) + public function getCrossMarginBorrowableWithHttpInfo($currency) { - $request = $this->repayCrossMarginLoanRequest($cross_margin_repay_request); + $request = $this->getCrossMarginBorrowableRequest($currency); $options = $this->createHttpClientOption(); try { @@ -6988,7 +8364,7 @@ public function repayCrossMarginLoanWithHttpInfo($cross_margin_repay_request) ); } - $returnType = '\GateApi\Model\CrossMarginLoan[]'; + $returnType = '\GateApi\Model\CrossMarginBorrowable'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -7004,18 +8380,18 @@ public function repayCrossMarginLoanWithHttpInfo($cross_margin_repay_request) } /** - * Operation repayCrossMarginLoanAsync + * Operation getCrossMarginBorrowableAsync * - * Repay cross margin loan + * Get the max borrowable amount for a specific cross margin currency * - * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function repayCrossMarginLoanAsync($cross_margin_repay_request) + public function getCrossMarginBorrowableAsync($currency) { - return $this->repayCrossMarginLoanAsyncWithHttpInfo($cross_margin_repay_request) + return $this->getCrossMarginBorrowableAsyncWithHttpInfo($currency) ->then( function ($response) { return $response[0]; @@ -7024,19 +8400,19 @@ function ($response) { } /** - * Operation repayCrossMarginLoanAsyncWithHttpInfo + * Operation getCrossMarginBorrowableAsyncWithHttpInfo * - * Repay cross margin loan + * Get the max borrowable amount for a specific cross margin currency * - * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function repayCrossMarginLoanAsyncWithHttpInfo($cross_margin_repay_request) + public function getCrossMarginBorrowableAsyncWithHttpInfo($currency) { - $returnType = '\GateApi\Model\CrossMarginLoan[]'; - $request = $this->repayCrossMarginLoanRequest($cross_margin_repay_request); + $returnType = '\GateApi\Model\CrossMarginBorrowable'; + $request = $this->getCrossMarginBorrowableRequest($currency); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7073,34 +8449,43 @@ function ($exception) { } /** - * Create request for operation 'repayCrossMarginLoan' + * Create request for operation 'getCrossMarginBorrowable' * - * @param \GateApi\Model\CrossMarginRepayRequest $cross_margin_repay_request (required) + * @param string $currency Retrieve data of the specified currency (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function repayCrossMarginLoanRequest($cross_margin_repay_request) + protected function getCrossMarginBorrowableRequest($currency) { - // verify the required parameter 'cross_margin_repay_request' is set - if ($cross_margin_repay_request === null || (is_array($cross_margin_repay_request) && count($cross_margin_repay_request) === 0)) { + // verify the required parameter 'currency' is set + if ($currency === null || (is_array($currency) && count($currency) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $cross_margin_repay_request when calling repayCrossMarginLoan' + 'Missing the required parameter $currency when calling getCrossMarginBorrowable' ); } - $resourcePath = '/margin/cross/repayments'; + $resourcePath = '/margin/cross/borrowable'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + // body params $_tempBody = null; - if (isset($cross_margin_repay_request)) { - $_tempBody = $cross_margin_repay_request; - } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -7109,7 +8494,7 @@ protected function repayCrossMarginLoanRequest($cross_margin_repay_request) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } @@ -7143,7 +8528,7 @@ protected function repayCrossMarginLoanRequest($cross_margin_repay_request) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -7159,7 +8544,7 @@ protected function repayCrossMarginLoanRequest($cross_margin_repay_request) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/src/Api/OptionsApi.php b/src/Api/OptionsApi.php new file mode 100644 index 0000000..5169566 --- /dev/null +++ b/src/Api/OptionsApi.php @@ -0,0 +1,6902 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $host_index; + } + + /** + * Set the host index + * + * @param int Host index (required) + */ + public function setHostIndex($host_index) + { + $this->hostIndex = $host_index; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation listOptionsUnderlyings + * + * List all underlyings + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsUnderlying[] + */ + public function listOptionsUnderlyings() + { + list($response) = $this->listOptionsUnderlyingsWithHttpInfo(); + return $response; + } + + /** + * Operation listOptionsUnderlyingsWithHttpInfo + * + * List all underlyings + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsUnderlying[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsUnderlyingsWithHttpInfo() + { + $request = $this->listOptionsUnderlyingsRequest(); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsUnderlying[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsUnderlyingsAsync + * + * List all underlyings + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsUnderlyingsAsync() + { + return $this->listOptionsUnderlyingsAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsUnderlyingsAsyncWithHttpInfo + * + * List all underlyings + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsUnderlyingsAsyncWithHttpInfo() + { + $returnType = '\GateApi\Model\OptionsUnderlying[]'; + $request = $this->listOptionsUnderlyingsRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsUnderlyings' + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsUnderlyingsRequest() + { + + $resourcePath = '/options/underlyings'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsExpirations + * + * List all expiration times + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return int[] + */ + public function listOptionsExpirations($underlying) + { + list($response) = $this->listOptionsExpirationsWithHttpInfo($underlying); + return $response; + } + + /** + * Operation listOptionsExpirationsWithHttpInfo + * + * List all expiration times + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of int[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsExpirationsWithHttpInfo($underlying) + { + $request = $this->listOptionsExpirationsRequest($underlying); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = 'int[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsExpirationsAsync + * + * List all expiration times + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsExpirationsAsync($underlying) + { + return $this->listOptionsExpirationsAsyncWithHttpInfo($underlying) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsExpirationsAsyncWithHttpInfo + * + * List all expiration times + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsExpirationsAsyncWithHttpInfo($underlying) + { + $returnType = 'int[]'; + $request = $this->listOptionsExpirationsRequest($underlying); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsExpirations' + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsExpirationsRequest($underlying) + { + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsExpirations' + ); + } + + $resourcePath = '/options/expirations'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsContracts + * + * List all the contracts with specified underlying and expiration time + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $expiration Unix timestamp of the expiration time (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsContract[] + */ + public function listOptionsContracts($associative_array) + { + list($response) = $this->listOptionsContractsWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsContractsWithHttpInfo + * + * List all the contracts with specified underlying and expiration time + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $expiration Unix timestamp of the expiration time (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsContract[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsContractsWithHttpInfo($associative_array) + { + $request = $this->listOptionsContractsRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsContract[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsContractsAsync + * + * List all the contracts with specified underlying and expiration time + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $expiration Unix timestamp of the expiration time (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsContractsAsync($associative_array) + { + return $this->listOptionsContractsAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsContractsAsyncWithHttpInfo + * + * List all the contracts with specified underlying and expiration time + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $expiration Unix timestamp of the expiration time (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsContractsAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsContract[]'; + $request = $this->listOptionsContractsRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsContracts' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $expiration Unix timestamp of the expiration time (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsContractsRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $expiration = array_key_exists('expiration', $associative_array) ? $associative_array['expiration'] : null; + + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsContracts' + ); + } + + $resourcePath = '/options/contracts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($expiration !== null) { + if('form' === 'form' && is_array($expiration)) { + foreach($expiration as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['expiration'] = $expiration; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOptionsContract + * + * Query specified contract detail + * + * @param string $contract contract (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsContract + */ + public function getOptionsContract($contract) + { + list($response) = $this->getOptionsContractWithHttpInfo($contract); + return $response; + } + + /** + * Operation getOptionsContractWithHttpInfo + * + * Query specified contract detail + * + * @param string $contract (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsContract, HTTP status code, HTTP response headers (array of strings) + */ + public function getOptionsContractWithHttpInfo($contract) + { + $request = $this->getOptionsContractRequest($contract); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsContract'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getOptionsContractAsync + * + * Query specified contract detail + * + * @param string $contract (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsContractAsync($contract) + { + return $this->getOptionsContractAsyncWithHttpInfo($contract) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOptionsContractAsyncWithHttpInfo + * + * Query specified contract detail + * + * @param string $contract (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsContractAsyncWithHttpInfo($contract) + { + $returnType = '\GateApi\Model\OptionsContract'; + $request = $this->getOptionsContractRequest($contract); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOptionsContract' + * + * @param string $contract (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getOptionsContractRequest($contract) + { + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling getOptionsContract' + ); + } + + $resourcePath = '/options/contracts/{contract}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($contract !== null) { + $resourcePath = str_replace( + '{' . 'contract' . '}', + ObjectSerializer::toPathValue($contract), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsSettlements + * + * List settlement history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsSettlement[] + */ + public function listOptionsSettlements($associative_array) + { + list($response) = $this->listOptionsSettlementsWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsSettlementsWithHttpInfo + * + * List settlement history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsSettlement[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsSettlementsWithHttpInfo($associative_array) + { + $request = $this->listOptionsSettlementsRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsSettlement[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsSettlementsAsync + * + * List settlement history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsSettlementsAsync($associative_array) + { + return $this->listOptionsSettlementsAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsSettlementsAsyncWithHttpInfo + * + * List settlement history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsSettlementsAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsSettlement[]'; + $request = $this->listOptionsSettlementsRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsSettlements' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsSettlementsRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsSettlements' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsSettlements, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsSettlements, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling OptionsApi.listOptionsSettlements, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/options/settlements'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOptionsSettlement + * + * Get specified contract's settlement + * + * @param string $contract contract (required) + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $at at (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsSettlement + */ + public function getOptionsSettlement($contract, $underlying, $at) + { + list($response) = $this->getOptionsSettlementWithHttpInfo($contract, $underlying, $at); + return $response; + } + + /** + * Operation getOptionsSettlementWithHttpInfo + * + * Get specified contract's settlement + * + * @param string $contract (required) + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $at (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsSettlement, HTTP status code, HTTP response headers (array of strings) + */ + public function getOptionsSettlementWithHttpInfo($contract, $underlying, $at) + { + $request = $this->getOptionsSettlementRequest($contract, $underlying, $at); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsSettlement'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getOptionsSettlementAsync + * + * Get specified contract's settlement + * + * @param string $contract (required) + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $at (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsSettlementAsync($contract, $underlying, $at) + { + return $this->getOptionsSettlementAsyncWithHttpInfo($contract, $underlying, $at) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOptionsSettlementAsyncWithHttpInfo + * + * Get specified contract's settlement + * + * @param string $contract (required) + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $at (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsSettlementAsyncWithHttpInfo($contract, $underlying, $at) + { + $returnType = '\GateApi\Model\OptionsSettlement'; + $request = $this->getOptionsSettlementRequest($contract, $underlying, $at); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOptionsSettlement' + * + * @param string $contract (required) + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $at (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getOptionsSettlementRequest($contract, $underlying, $at) + { + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling getOptionsSettlement' + ); + } + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling getOptionsSettlement' + ); + } + // verify the required parameter 'at' is set + if ($at === null || (is_array($at) && count($at) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $at when calling getOptionsSettlement' + ); + } + + $resourcePath = '/options/settlements/{contract}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($at !== null) { + if('form' === 'form' && is_array($at)) { + foreach($at as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['at'] = $at; + } + } + + // path params + if ($contract !== null) { + $resourcePath = str_replace( + '{' . 'contract' . '}', + ObjectSerializer::toPathValue($contract), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMyOptionsSettlements + * + * List my options settlements + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsMySettlements[] + */ + public function listMyOptionsSettlements($associative_array) + { + list($response) = $this->listMyOptionsSettlementsWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listMyOptionsSettlementsWithHttpInfo + * + * List my options settlements + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsMySettlements[], HTTP status code, HTTP response headers (array of strings) + */ + public function listMyOptionsSettlementsWithHttpInfo($associative_array) + { + $request = $this->listMyOptionsSettlementsRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsMySettlements[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listMyOptionsSettlementsAsync + * + * List my options settlements + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMyOptionsSettlementsAsync($associative_array) + { + return $this->listMyOptionsSettlementsAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMyOptionsSettlementsAsyncWithHttpInfo + * + * List my options settlements + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMyOptionsSettlementsAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsMySettlements[]'; + $request = $this->listMyOptionsSettlementsRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listMyOptionsSettlements' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listMyOptionsSettlementsRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listMyOptionsSettlements' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listMyOptionsSettlements, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listMyOptionsSettlements, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling OptionsApi.listMyOptionsSettlements, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/options/my_settlements'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsOrderBook + * + * Options order book + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') + * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesOrderBook + */ + public function listOptionsOrderBook($associative_array) + { + list($response) = $this->listOptionsOrderBookWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsOrderBookWithHttpInfo + * + * Options order book + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') + * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FuturesOrderBook, HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsOrderBookWithHttpInfo($associative_array) + { + $request = $this->listOptionsOrderBookRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FuturesOrderBook'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsOrderBookAsync + * + * Options order book + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') + * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsOrderBookAsync($associative_array) + { + return $this->listOptionsOrderBookAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsOrderBookAsyncWithHttpInfo + * + * Options order book + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') + * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsOrderBookAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\FuturesOrderBook'; + $request = $this->listOptionsOrderBookRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsOrderBook' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param string $interval Order depth. 0 means no aggregation is applied. default to 0 (optional, default to '0') + * @param int $limit Maximum number of order depth data in asks or bids (optional, default to 10) + * @param bool $with_id Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional, default to false) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsOrderBookRequest($associative_array) + { + // unbox the parameters from the associative array + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $interval = array_key_exists('interval', $associative_array) ? $associative_array['interval'] : '0'; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 10; + $with_id = array_key_exists('with_id', $associative_array) ? $associative_array['with_id'] : false; + + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling listOptionsOrderBook' + ); + } + if ($limit !== null && $limit > 50) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsOrderBook, must be smaller than or equal to 50.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsOrderBook, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/options/order_book'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($interval !== null) { + if('form' === 'form' && is_array($interval)) { + foreach($interval as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['interval'] = $interval; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($with_id !== null) { + if('form' === 'form' && is_array($with_id)) { + foreach($with_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['with_id'] = $with_id; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsTickers + * + * List tickers of options contracts + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsTicker[] + */ + public function listOptionsTickers($underlying) + { + list($response) = $this->listOptionsTickersWithHttpInfo($underlying); + return $response; + } + + /** + * Operation listOptionsTickersWithHttpInfo + * + * List tickers of options contracts + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsTicker[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsTickersWithHttpInfo($underlying) + { + $request = $this->listOptionsTickersRequest($underlying); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsTicker[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsTickersAsync + * + * List tickers of options contracts + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsTickersAsync($underlying) + { + return $this->listOptionsTickersAsyncWithHttpInfo($underlying) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsTickersAsyncWithHttpInfo + * + * List tickers of options contracts + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsTickersAsyncWithHttpInfo($underlying) + { + $returnType = '\GateApi\Model\OptionsTicker[]'; + $request = $this->listOptionsTickersRequest($underlying); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsTickers' + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsTickersRequest($underlying) + { + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsTickers' + ); + } + + $resourcePath = '/options/tickers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsUnderlyingTickers + * + * Get underlying ticker + * + * @param string $underlying Underlying (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsUnderlyingTicker + */ + public function listOptionsUnderlyingTickers($underlying) + { + list($response) = $this->listOptionsUnderlyingTickersWithHttpInfo($underlying); + return $response; + } + + /** + * Operation listOptionsUnderlyingTickersWithHttpInfo + * + * Get underlying ticker + * + * @param string $underlying Underlying (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsUnderlyingTicker, HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsUnderlyingTickersWithHttpInfo($underlying) + { + $request = $this->listOptionsUnderlyingTickersRequest($underlying); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsUnderlyingTicker'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsUnderlyingTickersAsync + * + * Get underlying ticker + * + * @param string $underlying Underlying (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsUnderlyingTickersAsync($underlying) + { + return $this->listOptionsUnderlyingTickersAsyncWithHttpInfo($underlying) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsUnderlyingTickersAsyncWithHttpInfo + * + * Get underlying ticker + * + * @param string $underlying Underlying (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsUnderlyingTickersAsyncWithHttpInfo($underlying) + { + $returnType = '\GateApi\Model\OptionsUnderlyingTicker'; + $request = $this->listOptionsUnderlyingTickersRequest($underlying); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsUnderlyingTickers' + * + * @param string $underlying Underlying (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsUnderlyingTickersRequest($underlying) + { + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsUnderlyingTickers' + ); + } + + $resourcePath = '/options/underlying/tickers/{underlying}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($underlying !== null) { + $resourcePath = str_replace( + '{' . 'underlying' . '}', + ObjectSerializer::toPathValue($underlying), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsCandlesticks + * + * Get options candlesticks + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsCandlestick[] + */ + public function listOptionsCandlesticks($associative_array) + { + list($response) = $this->listOptionsCandlesticksWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsCandlesticksWithHttpInfo + * + * Get options candlesticks + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsCandlestick[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsCandlesticksWithHttpInfo($associative_array) + { + $request = $this->listOptionsCandlesticksRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsCandlestick[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsCandlesticksAsync + * + * Get options candlesticks + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsCandlesticksAsync($associative_array) + { + return $this->listOptionsCandlesticksAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsCandlesticksAsyncWithHttpInfo + * + * Get options candlesticks + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsCandlesticksAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsCandlestick[]'; + $request = $this->listOptionsCandlesticksRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsCandlesticks' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsCandlesticksRequest($associative_array) + { + // unbox the parameters from the associative array + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $interval = array_key_exists('interval', $associative_array) ? $associative_array['interval'] : '5m'; + + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling listOptionsCandlesticks' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsCandlesticks, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsCandlesticks, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/options/candlesticks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($interval !== null) { + if('form' === 'form' && is_array($interval)) { + foreach($interval as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['interval'] = $interval; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsUnderlyingCandlesticks + * + * Mark price candlesticks of an underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesCandlestick[] + */ + public function listOptionsUnderlyingCandlesticks($associative_array) + { + list($response) = $this->listOptionsUnderlyingCandlesticksWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsUnderlyingCandlesticksWithHttpInfo + * + * Mark price candlesticks of an underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FuturesCandlestick[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsUnderlyingCandlesticksWithHttpInfo($associative_array) + { + $request = $this->listOptionsUnderlyingCandlesticksRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FuturesCandlestick[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsUnderlyingCandlesticksAsync + * + * Mark price candlesticks of an underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsUnderlyingCandlesticksAsync($associative_array) + { + return $this->listOptionsUnderlyingCandlesticksAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsUnderlyingCandlesticksAsyncWithHttpInfo + * + * Mark price candlesticks of an underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsUnderlyingCandlesticksAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\FuturesCandlestick[]'; + $request = $this->listOptionsUnderlyingCandlesticksRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsUnderlyingCandlesticks' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $interval Interval time between data points (optional, default to '5m') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsUnderlyingCandlesticksRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $interval = array_key_exists('interval', $associative_array) ? $associative_array['interval'] : '5m'; + + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsUnderlyingCandlesticks' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsUnderlyingCandlesticks, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsUnderlyingCandlesticks, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/options/underlying/candlesticks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($interval !== null) { + if('form' === 'form' && is_array($interval)) { + foreach($interval as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['interval'] = $interval; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsTrades + * + * Options trade history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (optional) + * @param string $type `C` is call, while `P` is put (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\FuturesTrade[] + */ + public function listOptionsTrades($associative_array) + { + list($response) = $this->listOptionsTradesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsTradesWithHttpInfo + * + * Options trade history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (optional) + * @param string $type `C` is call, while `P` is put (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\FuturesTrade[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsTradesWithHttpInfo($associative_array) + { + $request = $this->listOptionsTradesRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\FuturesTrade[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsTradesAsync + * + * Options trade history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (optional) + * @param string $type `C` is call, while `P` is put (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsTradesAsync($associative_array) + { + return $this->listOptionsTradesAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsTradesAsyncWithHttpInfo + * + * Options trade history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (optional) + * @param string $type `C` is call, while `P` is put (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsTradesAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\FuturesTrade[]'; + $request = $this->listOptionsTradesRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsTrades' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $contract Options contract name (optional) + * @param string $type `C` is call, while `P` is put (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsTradesRequest($associative_array) + { + // unbox the parameters from the associative array + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $type = array_key_exists('type', $associative_array) ? $associative_array['type'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsTrades, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsTrades, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling OptionsApi.listOptionsTrades, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/options/trades'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($type !== null) { + if('form' === 'form' && is_array($type)) { + foreach($type as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['type'] = $type; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsAccount + * + * List options account + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsAccount + */ + public function listOptionsAccount() + { + list($response) = $this->listOptionsAccountWithHttpInfo(); + return $response; + } + + /** + * Operation listOptionsAccountWithHttpInfo + * + * List options account + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsAccount, HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsAccountWithHttpInfo() + { + $request = $this->listOptionsAccountRequest(); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsAccount'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsAccountAsync + * + * List options account + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsAccountAsync() + { + return $this->listOptionsAccountAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsAccountAsyncWithHttpInfo + * + * List options account + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsAccountAsyncWithHttpInfo() + { + $returnType = '\GateApi\Model\OptionsAccount'; + $request = $this->listOptionsAccountRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsAccount' + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsAccountRequest() + { + + $resourcePath = '/options/accounts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsAccountBook + * + * List account changing history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsAccountBook[] + */ + public function listOptionsAccountBook($associative_array) + { + list($response) = $this->listOptionsAccountBookWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsAccountBookWithHttpInfo + * + * List account changing history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsAccountBook[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsAccountBookWithHttpInfo($associative_array) + { + $request = $this->listOptionsAccountBookRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsAccountBook[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsAccountBookAsync + * + * List account changing history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsAccountBookAsync($associative_array) + { + return $this->listOptionsAccountBookAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsAccountBookAsyncWithHttpInfo + * + * List account changing history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsAccountBookAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsAccountBook[]'; + $request = $this->listOptionsAccountBookRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsAccountBook' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * @param string $type Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsAccountBookRequest($associative_array) + { + // unbox the parameters from the associative array + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $type = array_key_exists('type', $associative_array) ? $associative_array['type'] : null; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsAccountBook, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsAccountBook, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling OptionsApi.listOptionsAccountBook, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/options/account_book'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($type !== null) { + if('form' === 'form' && is_array($type)) { + foreach($type as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['type'] = $type; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsPositions + * + * List user's positions of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsPosition[] + */ + public function listOptionsPositions($associative_array) + { + list($response) = $this->listOptionsPositionsWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsPositionsWithHttpInfo + * + * List user's positions of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsPosition[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsPositionsWithHttpInfo($associative_array) + { + $request = $this->listOptionsPositionsRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsPosition[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsPositionsAsync + * + * List user's positions of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsPositionsAsync($associative_array) + { + return $this->listOptionsPositionsAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsPositionsAsyncWithHttpInfo + * + * List user's positions of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsPositionsAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsPosition[]'; + $request = $this->listOptionsPositionsRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsPositions' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsPositionsRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + + + $resourcePath = '/options/positions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOptionsPosition + * + * Get specified contract position + * + * @param string $contract contract (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsPosition + */ + public function getOptionsPosition($contract) + { + list($response) = $this->getOptionsPositionWithHttpInfo($contract); + return $response; + } + + /** + * Operation getOptionsPositionWithHttpInfo + * + * Get specified contract position + * + * @param string $contract (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsPosition, HTTP status code, HTTP response headers (array of strings) + */ + public function getOptionsPositionWithHttpInfo($contract) + { + $request = $this->getOptionsPositionRequest($contract); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsPosition'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getOptionsPositionAsync + * + * Get specified contract position + * + * @param string $contract (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsPositionAsync($contract) + { + return $this->getOptionsPositionAsyncWithHttpInfo($contract) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOptionsPositionAsyncWithHttpInfo + * + * Get specified contract position + * + * @param string $contract (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsPositionAsyncWithHttpInfo($contract) + { + $returnType = '\GateApi\Model\OptionsPosition'; + $request = $this->getOptionsPositionRequest($contract); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOptionsPosition' + * + * @param string $contract (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getOptionsPositionRequest($contract) + { + // verify the required parameter 'contract' is set + if ($contract === null || (is_array($contract) && count($contract) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contract when calling getOptionsPosition' + ); + } + + $resourcePath = '/options/positions/{contract}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($contract !== null) { + $resourcePath = str_replace( + '{' . 'contract' . '}', + ObjectSerializer::toPathValue($contract), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsPositionClose + * + * List user's liquidation history of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsPositionClose[] + */ + public function listOptionsPositionClose($associative_array) + { + list($response) = $this->listOptionsPositionCloseWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsPositionCloseWithHttpInfo + * + * List user's liquidation history of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsPositionClose[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsPositionCloseWithHttpInfo($associative_array) + { + $request = $this->listOptionsPositionCloseRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsPositionClose[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsPositionCloseAsync + * + * List user's liquidation history of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsPositionCloseAsync($associative_array) + { + return $this->listOptionsPositionCloseAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsPositionCloseAsyncWithHttpInfo + * + * List user's liquidation history of specified underlying + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsPositionCloseAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsPositionClose[]'; + $request = $this->listOptionsPositionCloseRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsPositionClose' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsPositionCloseRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listOptionsPositionClose' + ); + } + + $resourcePath = '/options/position_close'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listOptionsOrders + * + * List options orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $status Only list the orders with this status (required) + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsOrder[] + */ + public function listOptionsOrders($associative_array) + { + list($response) = $this->listOptionsOrdersWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listOptionsOrdersWithHttpInfo + * + * List options orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $status Only list the orders with this status (required) + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsOrder[], HTTP status code, HTTP response headers (array of strings) + */ + public function listOptionsOrdersWithHttpInfo($associative_array) + { + $request = $this->listOptionsOrdersRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsOrder[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listOptionsOrdersAsync + * + * List options orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $status Only list the orders with this status (required) + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsOrdersAsync($associative_array) + { + return $this->listOptionsOrdersAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOptionsOrdersAsyncWithHttpInfo + * + * List options orders + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $status Only list the orders with this status (required) + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOptionsOrdersAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsOrder[]'; + $request = $this->listOptionsOrdersRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listOptionsOrders' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $status Only list the orders with this status (required) + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listOptionsOrdersRequest($associative_array) + { + // unbox the parameters from the associative array + $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + // verify the required parameter 'status' is set + if ($status === null || (is_array($status) && count($status) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling listOptionsOrders' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsOrders, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listOptionsOrders, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling OptionsApi.listOptionsOrders, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/options/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($status !== null) { + if('form' === 'form' && is_array($status)) { + foreach($status as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['status'] = $status; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createOptionsOrder + * + * Create an options order + * + * @param \GateApi\Model\OptionsOrder $options_order options_order (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsOrder + */ + public function createOptionsOrder($options_order) + { + list($response) = $this->createOptionsOrderWithHttpInfo($options_order); + return $response; + } + + /** + * Operation createOptionsOrderWithHttpInfo + * + * Create an options order + * + * @param \GateApi\Model\OptionsOrder $options_order (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function createOptionsOrderWithHttpInfo($options_order) + { + $request = $this->createOptionsOrderRequest($options_order); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation createOptionsOrderAsync + * + * Create an options order + * + * @param \GateApi\Model\OptionsOrder $options_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createOptionsOrderAsync($options_order) + { + return $this->createOptionsOrderAsyncWithHttpInfo($options_order) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOptionsOrderAsyncWithHttpInfo + * + * Create an options order + * + * @param \GateApi\Model\OptionsOrder $options_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createOptionsOrderAsyncWithHttpInfo($options_order) + { + $returnType = '\GateApi\Model\OptionsOrder'; + $request = $this->createOptionsOrderRequest($options_order); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createOptionsOrder' + * + * @param \GateApi\Model\OptionsOrder $options_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createOptionsOrderRequest($options_order) + { + // verify the required parameter 'options_order' is set + if ($options_order === null || (is_array($options_order) && count($options_order) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $options_order when calling createOptionsOrder' + ); + } + + $resourcePath = '/options/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($options_order)) { + $_tempBody = $options_order; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelOptionsOrders + * + * Cancel all `open` orders matched + * + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsOrder[] + */ + public function cancelOptionsOrders($contract = null, $underlying = null, $side = null) + { + list($response) = $this->cancelOptionsOrdersWithHttpInfo($contract, $underlying, $side); + return $response; + } + + /** + * Operation cancelOptionsOrdersWithHttpInfo + * + * Cancel all `open` orders matched + * + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsOrder[], HTTP status code, HTTP response headers (array of strings) + */ + public function cancelOptionsOrdersWithHttpInfo($contract = null, $underlying = null, $side = null) + { + $request = $this->cancelOptionsOrdersRequest($contract, $underlying, $side); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsOrder[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation cancelOptionsOrdersAsync + * + * Cancel all `open` orders matched + * + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelOptionsOrdersAsync($contract = null, $underlying = null, $side = null) + { + return $this->cancelOptionsOrdersAsyncWithHttpInfo($contract, $underlying, $side) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelOptionsOrdersAsyncWithHttpInfo + * + * Cancel all `open` orders matched + * + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelOptionsOrdersAsyncWithHttpInfo($contract = null, $underlying = null, $side = null) + { + $returnType = '\GateApi\Model\OptionsOrder[]'; + $request = $this->cancelOptionsOrdersRequest($contract, $underlying, $side); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelOptionsOrders' + * + * @param string $contract Options contract name (optional) + * @param string $underlying Underlying (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cancelOptionsOrdersRequest($contract = null, $underlying = null, $side = null) + { + + $resourcePath = '/options/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($side !== null) { + if('form' === 'form' && is_array($side)) { + foreach($side as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['side'] = $side; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOptionsOrder + * + * Get a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsOrder + */ + public function getOptionsOrder($order_id) + { + list($response) = $this->getOptionsOrderWithHttpInfo($order_id); + return $response; + } + + /** + * Operation getOptionsOrderWithHttpInfo + * + * Get a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function getOptionsOrderWithHttpInfo($order_id) + { + $request = $this->getOptionsOrderRequest($order_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getOptionsOrderAsync + * + * Get a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsOrderAsync($order_id) + { + return $this->getOptionsOrderAsyncWithHttpInfo($order_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOptionsOrderAsyncWithHttpInfo + * + * Get a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOptionsOrderAsyncWithHttpInfo($order_id) + { + $returnType = '\GateApi\Model\OptionsOrder'; + $request = $this->getOptionsOrderRequest($order_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOptionsOrder' + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getOptionsOrderRequest($order_id) + { + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling getOptionsOrder' + ); + } + + $resourcePath = '/options/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelOptionsOrder + * + * Cancel a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsOrder + */ + public function cancelOptionsOrder($order_id) + { + list($response) = $this->cancelOptionsOrderWithHttpInfo($order_id); + return $response; + } + + /** + * Operation cancelOptionsOrderWithHttpInfo + * + * Cancel a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsOrder, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelOptionsOrderWithHttpInfo($order_id) + { + $request = $this->cancelOptionsOrderRequest($order_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsOrder'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation cancelOptionsOrderAsync + * + * Cancel a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelOptionsOrderAsync($order_id) + { + return $this->cancelOptionsOrderAsyncWithHttpInfo($order_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelOptionsOrderAsyncWithHttpInfo + * + * Cancel a single order + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelOptionsOrderAsyncWithHttpInfo($order_id) + { + $returnType = '\GateApi\Model\OptionsOrder'; + $request = $this->cancelOptionsOrderRequest($order_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelOptionsOrder' + * + * @param int $order_id Order ID returned on successful order creation (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cancelOptionsOrderRequest($order_id) + { + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling cancelOptionsOrder' + ); + } + + $resourcePath = '/options/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMyOptionsTrades + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\OptionsMyTrade[] + */ + public function listMyOptionsTrades($associative_array) + { + list($response) = $this->listMyOptionsTradesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listMyOptionsTradesWithHttpInfo + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\OptionsMyTrade[], HTTP status code, HTTP response headers (array of strings) + */ + public function listMyOptionsTradesWithHttpInfo($associative_array) + { + $request = $this->listMyOptionsTradesRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\OptionsMyTrade[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listMyOptionsTradesAsync + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMyOptionsTradesAsync($associative_array) + { + return $this->listMyOptionsTradesAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMyOptionsTradesAsyncWithHttpInfo + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMyOptionsTradesAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\OptionsMyTrade[]'; + $request = $this->listMyOptionsTradesRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listMyOptionsTrades' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $underlying Underlying (Obtained by listing underlying endpoint) (required) + * @param string $contract Options contract name (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * @param int $from Start timestamp (optional) + * @param int $to End timestamp (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listMyOptionsTradesRequest($associative_array) + { + // unbox the parameters from the associative array + $underlying = array_key_exists('underlying', $associative_array) ? $associative_array['underlying'] : null; + $contract = array_key_exists('contract', $associative_array) ? $associative_array['contract'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + // verify the required parameter 'underlying' is set + if ($underlying === null || (is_array($underlying) && count($underlying) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $underlying when calling listMyOptionsTrades' + ); + } + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listMyOptionsTrades, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OptionsApi.listMyOptionsTrades, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling OptionsApi.listMyOptionsTrades, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/options/my_trades'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($underlying !== null) { + if('form' === 'form' && is_array($underlying)) { + foreach($underlying as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['underlying'] = $underlying; + } + } + + // query params + if ($contract !== null) { + if('form' === 'form' && is_array($contract)) { + foreach($contract as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['contract'] = $contract; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Api/RebateApi.php b/src/Api/RebateApi.php new file mode 100644 index 0000000..387dcb5 --- /dev/null +++ b/src/Api/RebateApi.php @@ -0,0 +1,836 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $host_index; + } + + /** + * Set the host index + * + * @param int Host index (required) + */ + public function setHostIndex($host_index) + { + $this->hostIndex = $host_index; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation agencyTransactionHistory + * + * The broker obtains the transaction history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify the currency pair, if not specified, return all currency pairs (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\AgencyTransactionHistory[] + */ + public function agencyTransactionHistory($associative_array) + { + list($response) = $this->agencyTransactionHistoryWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation agencyTransactionHistoryWithHttpInfo + * + * The broker obtains the transaction history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify the currency pair, if not specified, return all currency pairs (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\AgencyTransactionHistory[], HTTP status code, HTTP response headers (array of strings) + */ + public function agencyTransactionHistoryWithHttpInfo($associative_array) + { + $request = $this->agencyTransactionHistoryRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\AgencyTransactionHistory[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation agencyTransactionHistoryAsync + * + * The broker obtains the transaction history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify the currency pair, if not specified, return all currency pairs (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function agencyTransactionHistoryAsync($associative_array) + { + return $this->agencyTransactionHistoryAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation agencyTransactionHistoryAsyncWithHttpInfo + * + * The broker obtains the transaction history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify the currency pair, if not specified, return all currency pairs (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function agencyTransactionHistoryAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\AgencyTransactionHistory[]'; + $request = $this->agencyTransactionHistoryRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'agencyTransactionHistory' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify the currency pair, if not specified, return all currency pairs (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function agencyTransactionHistoryRequest($associative_array) + { + // unbox the parameters from the associative array + $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; + $user_id = array_key_exists('user_id', $associative_array) ? $associative_array['user_id'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RebateApi.agencyTransactionHistory, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RebateApi.agencyTransactionHistory, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling RebateApi.agencyTransactionHistory, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/rebate/agency/transaction_history'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($user_id !== null) { + if('form' === 'form' && is_array($user_id)) { + foreach($user_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['user_id'] = $user_id; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation agencyCommissionsHistory + * + * The broker obtains the commission history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency. Return all currency records if not specified (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\AgencyCommissionHistory[] + */ + public function agencyCommissionsHistory($associative_array) + { + list($response) = $this->agencyCommissionsHistoryWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation agencyCommissionsHistoryWithHttpInfo + * + * The broker obtains the commission history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency. Return all currency records if not specified (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\AgencyCommissionHistory[], HTTP status code, HTTP response headers (array of strings) + */ + public function agencyCommissionsHistoryWithHttpInfo($associative_array) + { + $request = $this->agencyCommissionsHistoryRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\AgencyCommissionHistory[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation agencyCommissionsHistoryAsync + * + * The broker obtains the commission history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency. Return all currency records if not specified (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function agencyCommissionsHistoryAsync($associative_array) + { + return $this->agencyCommissionsHistoryAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation agencyCommissionsHistoryAsyncWithHttpInfo + * + * The broker obtains the commission history of the recommended user + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency. Return all currency records if not specified (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function agencyCommissionsHistoryAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\AgencyCommissionHistory[]'; + $request = $this->agencyCommissionsHistoryRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'agencyCommissionsHistory' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Filter by currency. Return all currency records if not specified (optional) + * @param string $user_id User ID. If not specified, all user records will be returned (optional) + * @param int $from Time range beginning, default to 7 days before current time (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $offset List offset, starting from 0 (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function agencyCommissionsHistoryRequest($associative_array) + { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $user_id = array_key_exists('user_id', $associative_array) ? $associative_array['user_id'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $offset = array_key_exists('offset', $associative_array) ? $associative_array['offset'] : 0; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RebateApi.agencyCommissionsHistory, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RebateApi.agencyCommissionsHistory, must be bigger than or equal to 1.'); + } + + if ($offset !== null && $offset < 0) { + throw new \InvalidArgumentException('invalid value for "$offset" when calling RebateApi.agencyCommissionsHistory, must be bigger than or equal to 0.'); + } + + + $resourcePath = '/rebate/agency/commission_history'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($user_id !== null) { + if('form' === 'form' && is_array($user_id)) { + foreach($user_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['user_id'] = $user_id; + } + } + + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($offset !== null) { + if('form' === 'form' && is_array($offset)) { + foreach($offset as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['offset'] = $offset; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Api/SpotApi.php b/src/Api/SpotApi.php index 4978273..6acaedd 100644 --- a/src/Api/SpotApi.php +++ b/src/Api/SpotApi.php @@ -116,7 +116,7 @@ public function getConfig() /** * Operation listCurrencies * - * List all currencies' detail + * List all currencies' details * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -131,7 +131,7 @@ public function listCurrencies() /** * Operation listCurrenciesWithHttpInfo * - * List all currencies' detail + * List all currencies' details * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -183,7 +183,7 @@ public function listCurrenciesWithHttpInfo() /** * Operation listCurrenciesAsync * - * List all currencies' detail + * List all currencies' details * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -201,7 +201,7 @@ function ($response) { /** * Operation listCurrenciesAsyncWithHttpInfo * - * List all currencies' detail + * List all currencies' details * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -328,7 +328,7 @@ protected function listCurrenciesRequest() /** * Operation getCurrency * - * Get detail of one particular currency + * Get details of a specific currency * * @param string $currency Currency name (required) * @@ -345,7 +345,7 @@ public function getCurrency($currency) /** * Operation getCurrencyWithHttpInfo * - * Get detail of one particular currency + * Get details of a specific currency * * @param string $currency Currency name (required) * @@ -399,7 +399,7 @@ public function getCurrencyWithHttpInfo($currency) /** * Operation getCurrencyAsync * - * Get detail of one particular currency + * Get details of a specific currency * * @param string $currency Currency name (required) * @@ -419,7 +419,7 @@ function ($response) { /** * Operation getCurrencyAsyncWithHttpInfo * - * Get detail of one particular currency + * Get details of a specific currency * * @param string $currency Currency name (required) * @@ -777,7 +777,7 @@ protected function listCurrencyPairsRequest() /** * Operation getCurrencyPair * - * Get detail of one single order + * Get details of a specifc currency pair * * @param string $currency_pair Currency pair (required) * @@ -794,7 +794,7 @@ public function getCurrencyPair($currency_pair) /** * Operation getCurrencyPairWithHttpInfo * - * Get detail of one single order + * Get details of a specifc currency pair * * @param string $currency_pair Currency pair (required) * @@ -848,7 +848,7 @@ public function getCurrencyPairWithHttpInfo($currency_pair) /** * Operation getCurrencyPairAsync * - * Get detail of one single order + * Get details of a specifc currency pair * * @param string $currency_pair Currency pair (required) * @@ -868,7 +868,7 @@ function ($response) { /** * Operation getCurrencyPairAsyncWithHttpInfo * - * Get detail of one single order + * Get details of a specifc currency pair * * @param string $currency_pair Currency pair (required) * @@ -1019,6 +1019,7 @@ protected function getCurrencyPairRequest($currency_pair) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (optional) + * @param string $timezone Timezone (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1038,6 +1039,7 @@ public function listTickers($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (optional) + * @param string $timezone Timezone (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1094,6 +1096,7 @@ public function listTickersWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (optional) + * @param string $timezone Timezone (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1116,6 +1119,7 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (optional) + * @param string $timezone Timezone (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1165,6 +1169,7 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (optional) + * @param string $timezone Timezone (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1173,6 +1178,7 @@ protected function listTickersRequest($associative_array) { // unbox the parameters from the associative array $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; + $timezone = array_key_exists('timezone', $associative_array) ? $associative_array['timezone'] : null; $resourcePath = '/spot/tickers'; @@ -1194,6 +1200,18 @@ protected function listTickersRequest($associative_array) } } + // query params + if ($timezone !== null) { + if('form' === 'form' && is_array($timezone)) { + foreach($timezone as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['timezone'] = $timezone; + } + } + // body params $_tempBody = null; @@ -1445,9 +1463,6 @@ protected function listOrderBookRequest($associative_array) 'Missing the required parameter $currency_pair when calling listOrderBook' ); } - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listOrderBook, must be smaller than or equal to 100.'); - } if ($limit !== null && $limit < 1) { throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listOrderBook, must be bigger than or equal to 1.'); } @@ -1580,9 +1595,12 @@ protected function listOrderBookRequest($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 (optional, default to 100) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param bool $reverse Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param bool $reverse Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1602,9 +1620,12 @@ public function listTrades($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 (optional, default to 100) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param bool $reverse Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param bool $reverse Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1661,9 +1682,12 @@ public function listTradesWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 (optional, default to 100) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param bool $reverse Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param bool $reverse Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1686,9 +1710,12 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 (optional, default to 100) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param bool $reverse Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param bool $reverse Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1738,9 +1765,12 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list. Default: 100, Minimum: 1, Maximum: 1000 (optional, default to 100) * @param string $last_id Specify list staring point using the `id` of last record in previous list-query results (optional) - * @param bool $reverse Whether to retrieve records whose IDs are smaller than `last_id`'s. Default to larger ones. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param bool $reverse Whether the id of records to be retrieved should be less than the last_id specified. Default to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional, default to false) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param int $page Page number (optional, default to 1) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -1752,6 +1782,9 @@ protected function listTradesRequest($associative_array) $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; $last_id = array_key_exists('last_id', $associative_array) ? $associative_array['last_id'] : null; $reverse = array_key_exists('reverse', $associative_array) ? $associative_array['reverse'] : false; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; // verify the required parameter 'currency_pair' is set if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { @@ -1766,6 +1799,10 @@ protected function listTradesRequest($associative_array) throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listTrades, must be bigger than or equal to 1.'); } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listTrades, must be bigger than or equal to 1.'); + } + $resourcePath = '/spot/trades'; $formParams = []; @@ -1822,6 +1859,42 @@ protected function listTradesRequest($associative_array) } } + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($page !== null) { + if('form' === 'form' && is_array($page)) { + foreach($page as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['page'] = $page; + } + } + // body params $_tempBody = null; @@ -1894,10 +1967,10 @@ protected function listTradesRequest($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param string $interval Interval time between data points (optional, default to '30m') + * @param string $interval Interval time between data points. Note that `30d` means 1 natual month, not 30 days (optional, default to '30m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1917,10 +1990,10 @@ public function listCandlesticks($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param string $interval Interval time between data points (optional, default to '30m') + * @param string $interval Interval time between data points. Note that `30d` means 1 natual month, not 30 days (optional, default to '30m') * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1977,10 +2050,10 @@ public function listCandlesticksWithHttpInfo($associative_array) * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param string $interval Interval time between data points (optional, default to '30m') + * @param string $interval Interval time between data points. Note that `30d` means 1 natual month, not 30 days (optional, default to '30m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2003,10 +2076,10 @@ function ($response) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param string $interval Interval time between data points (optional, default to '30m') + * @param string $interval Interval time between data points. Note that `30d` means 1 natual month, not 30 days (optional, default to '30m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2056,10 +2129,10 @@ function ($exception) { * Note: the input parameter is an associative array with the keys listed as the parameter name below * * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) + * @param int $limit Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional, default to 100) * @param int $from Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) * @param int $to End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) - * @param string $interval Interval time between data points (optional, default to '30m') + * @param string $interval Interval time between data points. Note that `30d` means 1 natual month, not 30 days (optional, default to '30m') * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -2466,40 +2539,36 @@ protected function getFeeRequest($associative_array) } /** - * Operation listSpotAccounts - * - * List spot accounts + * Operation getBatchSpotFee * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Query a batch of user trading fee rates * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency_pairs A request can only query up to 50 currency pairs (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\SpotAccount[] + * @return map[string,\GateApi\Model\SpotFee] */ - public function listSpotAccounts($associative_array) + public function getBatchSpotFee($currency_pairs) { - list($response) = $this->listSpotAccountsWithHttpInfo($associative_array); + list($response) = $this->getBatchSpotFeeWithHttpInfo($currency_pairs); return $response; } /** - * Operation listSpotAccountsWithHttpInfo - * - * List spot accounts + * Operation getBatchSpotFeeWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Query a batch of user trading fee rates * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency_pairs A request can only query up to 50 currency pairs (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\SpotAccount[], HTTP status code, HTTP response headers (array of strings) + * @return array of map[string,\GateApi\Model\SpotFee], HTTP status code, HTTP response headers (array of strings) */ - public function listSpotAccountsWithHttpInfo($associative_array) + public function getBatchSpotFeeWithHttpInfo($currency_pairs) { - $request = $this->listSpotAccountsRequest($associative_array); + $request = $this->getBatchSpotFeeRequest($currency_pairs); $options = $this->createHttpClientOption(); try { @@ -2525,7 +2594,7 @@ public function listSpotAccountsWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\SpotAccount[]'; + $returnType = 'map[string,\GateApi\Model\SpotFee]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -2541,20 +2610,18 @@ public function listSpotAccountsWithHttpInfo($associative_array) } /** - * Operation listSpotAccountsAsync - * - * List spot accounts + * Operation getBatchSpotFeeAsync * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Query a batch of user trading fee rates * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency_pairs A request can only query up to 50 currency pairs (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listSpotAccountsAsync($associative_array) + public function getBatchSpotFeeAsync($currency_pairs) { - return $this->listSpotAccountsAsyncWithHttpInfo($associative_array) + return $this->getBatchSpotFeeAsyncWithHttpInfo($currency_pairs) ->then( function ($response) { return $response[0]; @@ -2563,21 +2630,19 @@ function ($response) { } /** - * Operation listSpotAccountsAsyncWithHttpInfo - * - * List spot accounts + * Operation getBatchSpotFeeAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Query a batch of user trading fee rates * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency_pairs A request can only query up to 50 currency pairs (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listSpotAccountsAsyncWithHttpInfo($associative_array) + public function getBatchSpotFeeAsyncWithHttpInfo($currency_pairs) { - $returnType = '\GateApi\Model\SpotAccount[]'; - $request = $this->listSpotAccountsRequest($associative_array); + $returnType = 'map[string,\GateApi\Model\SpotFee]'; + $request = $this->getBatchSpotFeeRequest($currency_pairs); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2614,22 +2679,23 @@ function ($exception) { } /** - * Create request for operation 'listSpotAccounts' - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create request for operation 'getBatchSpotFee' * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency_pairs A request can only query up to 50 currency pairs (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listSpotAccountsRequest($associative_array) + protected function getBatchSpotFeeRequest($currency_pairs) { - // unbox the parameters from the associative array - $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; - + // verify the required parameter 'currency_pairs' is set + if ($currency_pairs === null || (is_array($currency_pairs) && count($currency_pairs) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency_pairs when calling getBatchSpotFee' + ); + } - $resourcePath = '/spot/accounts'; + $resourcePath = '/spot/batch_fee'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2637,14 +2703,14 @@ protected function listSpotAccountsRequest($associative_array) $multipart = false; // query params - if ($currency !== null) { - if('form' === 'form' && is_array($currency)) { - foreach($currency as $key => $value) { + if ($currency_pairs !== null) { + if('form' === 'form' && is_array($currency_pairs)) { + foreach($currency_pairs as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['currency'] = $currency; + $queryParams['currency_pairs'] = $currency_pairs; } } @@ -2716,36 +2782,40 @@ protected function listSpotAccountsRequest($associative_array) } /** - * Operation createBatchOrders + * Operation listSpotAccounts * - * Create a batch of orders + * List spot accounts * - * @param \GateApi\Model\Order[] $order order (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\BatchOrder[] + * @return \GateApi\Model\SpotAccount[] */ - public function createBatchOrders($order) + public function listSpotAccounts($associative_array) { - list($response) = $this->createBatchOrdersWithHttpInfo($order); + list($response) = $this->listSpotAccountsWithHttpInfo($associative_array); return $response; } /** - * Operation createBatchOrdersWithHttpInfo + * Operation listSpotAccountsWithHttpInfo * - * Create a batch of orders + * List spot accounts * - * @param \GateApi\Model\Order[] $order (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\BatchOrder[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\SpotAccount[], HTTP status code, HTTP response headers (array of strings) */ - public function createBatchOrdersWithHttpInfo($order) + public function listSpotAccountsWithHttpInfo($associative_array) { - $request = $this->createBatchOrdersRequest($order); + $request = $this->listSpotAccountsRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -2771,7 +2841,7 @@ public function createBatchOrdersWithHttpInfo($order) ); } - $returnType = '\GateApi\Model\BatchOrder[]'; + $returnType = '\GateApi\Model\SpotAccount[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -2787,18 +2857,20 @@ public function createBatchOrdersWithHttpInfo($order) } /** - * Operation createBatchOrdersAsync + * Operation listSpotAccountsAsync * - * Create a batch of orders + * List spot accounts * - * @param \GateApi\Model\Order[] $order (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createBatchOrdersAsync($order) + public function listSpotAccountsAsync($associative_array) { - return $this->createBatchOrdersAsyncWithHttpInfo($order) + return $this->listSpotAccountsAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -2807,19 +2879,21 @@ function ($response) { } /** - * Operation createBatchOrdersAsyncWithHttpInfo + * Operation listSpotAccountsAsyncWithHttpInfo * - * Create a batch of orders + * List spot accounts * - * @param \GateApi\Model\Order[] $order (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createBatchOrdersAsyncWithHttpInfo($order) + public function listSpotAccountsAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\BatchOrder[]'; - $request = $this->createBatchOrdersRequest($order); + $returnType = '\GateApi\Model\SpotAccount[]'; + $request = $this->listSpotAccountsRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2856,34 +2930,42 @@ function ($exception) { } /** - * Create request for operation 'createBatchOrders' + * Create request for operation 'listSpotAccounts' * - * @param \GateApi\Model\Order[] $order (required) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createBatchOrdersRequest($order) + protected function listSpotAccountsRequest($associative_array) { - // verify the required parameter 'order' is set - if ($order === null || (is_array($order) && count($order) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $order when calling createBatchOrders' - ); - } + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; - $resourcePath = '/spot/batch_orders'; + + $resourcePath = '/spot/accounts'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + // body params $_tempBody = null; - if (isset($order)) { - $_tempBody = $order; - } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -2892,7 +2974,7 @@ protected function createBatchOrdersRequest($order) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } @@ -2926,7 +3008,7 @@ protected function createBatchOrdersRequest($order) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -2942,7 +3024,7 @@ protected function createBatchOrdersRequest($order) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2950,44 +3032,36 @@ protected function createBatchOrdersRequest($order) } /** - * Operation listAllOpenOrders - * - * List all open orders + * Operation createBatchOrders * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create a batch of orders * - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\Order[] $order order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\OpenOrders[] + * @return \GateApi\Model\BatchOrder[] */ - public function listAllOpenOrders($associative_array) + public function createBatchOrders($order) { - list($response) = $this->listAllOpenOrdersWithHttpInfo($associative_array); + list($response) = $this->createBatchOrdersWithHttpInfo($order); return $response; } /** - * Operation listAllOpenOrdersWithHttpInfo - * - * List all open orders + * Operation createBatchOrdersWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create a batch of orders * - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\Order[] $order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\OpenOrders[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\BatchOrder[], HTTP status code, HTTP response headers (array of strings) */ - public function listAllOpenOrdersWithHttpInfo($associative_array) + public function createBatchOrdersWithHttpInfo($order) { - $request = $this->listAllOpenOrdersRequest($associative_array); + $request = $this->createBatchOrdersRequest($order); $options = $this->createHttpClientOption(); try { @@ -3013,7 +3087,7 @@ public function listAllOpenOrdersWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\OpenOrders[]'; + $returnType = '\GateApi\Model\BatchOrder[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -3029,22 +3103,18 @@ public function listAllOpenOrdersWithHttpInfo($associative_array) } /** - * Operation listAllOpenOrdersAsync - * - * List all open orders + * Operation createBatchOrdersAsync * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create a batch of orders * - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\Order[] $order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listAllOpenOrdersAsync($associative_array) + public function createBatchOrdersAsync($order) { - return $this->listAllOpenOrdersAsyncWithHttpInfo($associative_array) + return $this->createBatchOrdersAsyncWithHttpInfo($order) ->then( function ($response) { return $response[0]; @@ -3053,23 +3123,19 @@ function ($response) { } /** - * Operation listAllOpenOrdersAsyncWithHttpInfo - * - * List all open orders + * Operation createBatchOrdersAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create a batch of orders * - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\Order[] $order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listAllOpenOrdersAsyncWithHttpInfo($associative_array) + public function createBatchOrdersAsyncWithHttpInfo($order) { - $returnType = '\GateApi\Model\OpenOrders[]'; - $request = $this->listAllOpenOrdersRequest($associative_array); + $returnType = '\GateApi\Model\BatchOrder[]'; + $request = $this->createBatchOrdersRequest($order); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3106,81 +3172,34 @@ function ($exception) { } /** - * Create request for operation 'listAllOpenOrders' + * Create request for operation 'createBatchOrders' * - * Note: the input parameter is an associative array with the keys listed as the parameter name below - * - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\Order[] $order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listAllOpenOrdersRequest($associative_array) + protected function createBatchOrdersRequest($order) { - // unbox the parameters from the associative array - $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $account = array_key_exists('account', $associative_array) ? $associative_array['account'] : null; - - if ($page !== null && $page < 1) { - throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listAllOpenOrders, must be bigger than or equal to 1.'); - } - - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listAllOpenOrders, must be smaller than or equal to 100.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listAllOpenOrders, must be bigger than or equal to 1.'); + // verify the required parameter 'order' is set + if ($order === null || (is_array($order) && count($order) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order when calling createBatchOrders' + ); } - - $resourcePath = '/spot/open_orders'; + $resourcePath = '/spot/batch_orders'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($page !== null) { - if('form' === 'form' && is_array($page)) { - foreach($page as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['page'] = $page; - } - } - - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - - // query params - if ($account !== null) { - if('form' === 'form' && is_array($account)) { - foreach($account as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['account'] = $account; - } - } - // body params $_tempBody = null; + if (isset($order)) { + $_tempBody = $order; + } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -3189,7 +3208,7 @@ protected function listAllOpenOrdersRequest($associative_array) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } @@ -3223,7 +3242,7 @@ protected function listAllOpenOrdersRequest($associative_array) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -3239,7 +3258,7 @@ protected function listAllOpenOrdersRequest($associative_array) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -3247,48 +3266,44 @@ protected function listAllOpenOrdersRequest($associative_array) } /** - * Operation listOrders + * Operation listAllOpenOrders * - * List orders + * List all open orders * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency_pair Currency pair (required) - * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Order[] + * @return \GateApi\Model\OpenOrders[] */ - public function listOrders($associative_array) + public function listAllOpenOrders($associative_array) { - list($response) = $this->listOrdersWithHttpInfo($associative_array); + list($response) = $this->listAllOpenOrdersWithHttpInfo($associative_array); return $response; } /** - * Operation listOrdersWithHttpInfo + * Operation listAllOpenOrdersWithHttpInfo * - * List orders + * List all open orders * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency_pair Currency pair (required) - * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Order[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\OpenOrders[], HTTP status code, HTTP response headers (array of strings) */ - public function listOrdersWithHttpInfo($associative_array) + public function listAllOpenOrdersWithHttpInfo($associative_array) { - $request = $this->listOrdersRequest($associative_array); + $request = $this->listAllOpenOrdersRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -3314,7 +3329,7 @@ public function listOrdersWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\Order[]'; + $returnType = '\GateApi\Model\OpenOrders[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -3330,24 +3345,22 @@ public function listOrdersWithHttpInfo($associative_array) } /** - * Operation listOrdersAsync + * Operation listAllOpenOrdersAsync * - * List orders + * List all open orders * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency_pair Currency pair (required) - * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listOrdersAsync($associative_array) + public function listAllOpenOrdersAsync($associative_array) { - return $this->listOrdersAsyncWithHttpInfo($associative_array) + return $this->listAllOpenOrdersAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -3356,25 +3369,23 @@ function ($response) { } /** - * Operation listOrdersAsyncWithHttpInfo + * Operation listAllOpenOrdersAsyncWithHttpInfo * - * List orders + * List all open orders * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency_pair Currency pair (required) - * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listOrdersAsyncWithHttpInfo($associative_array) + public function listAllOpenOrdersAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\Order[]'; - $request = $this->listOrdersRequest($associative_array); + $returnType = '\GateApi\Model\OpenOrders[]'; + $request = $this->listAllOpenOrdersRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3411,83 +3422,43 @@ function ($exception) { } /** - * Create request for operation 'listOrders' + * Create request for operation 'listAllOpenOrders' * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency_pair Currency pair (required) - * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) - * @param int $page Page number (optional, default to 1) - * @param int $limit Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records returned in one page in each currency pair (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listOrdersRequest($associative_array) + protected function listAllOpenOrdersRequest($associative_array) { // unbox the parameters from the associative array - $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; - $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; $account = array_key_exists('account', $associative_array) ? $associative_array['account'] : null; - // verify the required parameter 'currency_pair' is set - if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $currency_pair when calling listOrders' - ); - } - // verify the required parameter 'status' is set - if ($status === null || (is_array($status) && count($status) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $status when calling listOrders' - ); - } if ($page !== null && $page < 1) { - throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listOrders, must be bigger than or equal to 1.'); + throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listAllOpenOrders, must be bigger than or equal to 1.'); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listOrders, must be smaller than or equal to 1000.'); + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listAllOpenOrders, must be smaller than or equal to 100.'); } if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listOrders, must be bigger than or equal to 1.'); + throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listAllOpenOrders, must be bigger than or equal to 1.'); } - $resourcePath = '/spot/orders'; + $resourcePath = '/spot/open_orders'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($currency_pair !== null) { - if('form' === 'form' && is_array($currency_pair)) { - foreach($currency_pair as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['currency_pair'] = $currency_pair; - } - } - - // query params - if ($status !== null) { - if('form' === 'form' && is_array($status)) { - foreach($status as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['status'] = $status; - } - } - // query params if ($page !== null) { if('form' === 'form' && is_array($page)) { @@ -3592,36 +3563,36 @@ protected function listOrdersRequest($associative_array) } /** - * Operation createOrder + * Operation createCrossLiquidateOrder * - * Create an order + * close position when cross-currency is disabled * - * @param \GateApi\Model\Order $order order (required) + * @param \GateApi\Model\LiquidateOrder $liquidate_order liquidate_order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\Order */ - public function createOrder($order) + public function createCrossLiquidateOrder($liquidate_order) { - list($response) = $this->createOrderWithHttpInfo($order); + list($response) = $this->createCrossLiquidateOrderWithHttpInfo($liquidate_order); return $response; } /** - * Operation createOrderWithHttpInfo + * Operation createCrossLiquidateOrderWithHttpInfo * - * Create an order + * close position when cross-currency is disabled * - * @param \GateApi\Model\Order $order (required) + * @param \GateApi\Model\LiquidateOrder $liquidate_order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) */ - public function createOrderWithHttpInfo($order) + public function createCrossLiquidateOrderWithHttpInfo($liquidate_order) { - $request = $this->createOrderRequest($order); + $request = $this->createCrossLiquidateOrderRequest($liquidate_order); $options = $this->createHttpClientOption(); try { @@ -3663,18 +3634,18 @@ public function createOrderWithHttpInfo($order) } /** - * Operation createOrderAsync + * Operation createCrossLiquidateOrderAsync * - * Create an order + * close position when cross-currency is disabled * - * @param \GateApi\Model\Order $order (required) + * @param \GateApi\Model\LiquidateOrder $liquidate_order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createOrderAsync($order) + public function createCrossLiquidateOrderAsync($liquidate_order) { - return $this->createOrderAsyncWithHttpInfo($order) + return $this->createCrossLiquidateOrderAsyncWithHttpInfo($liquidate_order) ->then( function ($response) { return $response[0]; @@ -3683,19 +3654,19 @@ function ($response) { } /** - * Operation createOrderAsyncWithHttpInfo + * Operation createCrossLiquidateOrderAsyncWithHttpInfo * - * Create an order + * close position when cross-currency is disabled * - * @param \GateApi\Model\Order $order (required) + * @param \GateApi\Model\LiquidateOrder $liquidate_order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createOrderAsyncWithHttpInfo($order) + public function createCrossLiquidateOrderAsyncWithHttpInfo($liquidate_order) { $returnType = '\GateApi\Model\Order'; - $request = $this->createOrderRequest($order); + $request = $this->createCrossLiquidateOrderRequest($liquidate_order); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3732,23 +3703,23 @@ function ($exception) { } /** - * Create request for operation 'createOrder' + * Create request for operation 'createCrossLiquidateOrder' * - * @param \GateApi\Model\Order $order (required) + * @param \GateApi\Model\LiquidateOrder $liquidate_order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function createOrderRequest($order) + protected function createCrossLiquidateOrderRequest($liquidate_order) { - // verify the required parameter 'order' is set - if ($order === null || (is_array($order) && count($order) === 0)) { + // verify the required parameter 'liquidate_order' is set + if ($liquidate_order === null || (is_array($liquidate_order) && count($liquidate_order) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $order when calling createOrder' + 'Missing the required parameter $liquidate_order when calling createCrossLiquidateOrder' ); } - $resourcePath = '/spot/orders'; + $resourcePath = '/spot/cross_liquidate_orders'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3757,8 +3728,8 @@ protected function createOrderRequest($order) // body params $_tempBody = null; - if (isset($order)) { - $_tempBody = $order; + if (isset($liquidate_order)) { + $_tempBody = $liquidate_order; } if ($multipart) { @@ -3826,40 +3797,54 @@ protected function createOrderRequest($order) } /** - * Operation cancelOrders + * Operation listOrders * - * Cancel all `open` orders in specified currency pair + * List orders * - * @param string $currency_pair Currency pair (required) - * @param string $side All bids or asks. Both included in not specified (optional) - * @param string $account Specify account type. Default to all account types being included (optional) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. (required) + * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \GateApi\Model\Order[] */ - public function cancelOrders($currency_pair, $side = null, $account = null) + public function listOrders($associative_array) { - list($response) = $this->cancelOrdersWithHttpInfo($currency_pair, $side, $account); + list($response) = $this->listOrdersWithHttpInfo($associative_array); return $response; } /** - * Operation cancelOrdersWithHttpInfo + * Operation listOrdersWithHttpInfo * - * Cancel all `open` orders in specified currency pair + * List orders * - * @param string $currency_pair Currency pair (required) - * @param string $side All bids or asks. Both included in not specified (optional) - * @param string $account Specify account type. Default to all account types being included (optional) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. (required) + * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \GateApi\Model\Order[], HTTP status code, HTTP response headers (array of strings) */ - public function cancelOrdersWithHttpInfo($currency_pair, $side = null, $account = null) + public function listOrdersWithHttpInfo($associative_array) { - $request = $this->cancelOrdersRequest($currency_pair, $side, $account); + $request = $this->listOrdersRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -3901,20 +3886,27 @@ public function cancelOrdersWithHttpInfo($currency_pair, $side = null, $account } /** - * Operation cancelOrdersAsync + * Operation listOrdersAsync * - * Cancel all `open` orders in specified currency pair + * List orders * - * @param string $currency_pair Currency pair (required) - * @param string $side All bids or asks. Both included in not specified (optional) - * @param string $account Specify account type. Default to all account types being included (optional) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. (required) + * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelOrdersAsync($currency_pair, $side = null, $account = null) + public function listOrdersAsync($associative_array) { - return $this->cancelOrdersAsyncWithHttpInfo($currency_pair, $side, $account) + return $this->listOrdersAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -3923,21 +3915,28 @@ function ($response) { } /** - * Operation cancelOrdersAsyncWithHttpInfo + * Operation listOrdersAsyncWithHttpInfo * - * Cancel all `open` orders in specified currency pair + * List orders * - * @param string $currency_pair Currency pair (required) - * @param string $side All bids or asks. Both included in not specified (optional) - * @param string $account Specify account type. Default to all account types being included (optional) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. (required) + * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelOrdersAsyncWithHttpInfo($currency_pair, $side = null, $account = null) + public function listOrdersAsyncWithHttpInfo($associative_array) { $returnType = '\GateApi\Model\Order[]'; - $request = $this->cancelOrdersRequest($currency_pair, $side, $account); + $request = $this->listOrdersRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3974,23 +3973,57 @@ function ($exception) { } /** - * Create request for operation 'cancelOrders' + * Create request for operation 'listOrders' * - * @param string $currency_pair Currency pair (required) - * @param string $side All bids or asks. Both included in not specified (optional) - * @param string $account Specify account type. Default to all account types being included (optional) + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair. It is required for open orders, but optional for finished ones. (required) + * @param string $status List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) + * @param int $page Page number (optional, default to 1) + * @param int $limit Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 (optional, default to 100) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * @param string $side All bids or asks. Both included if not specified (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function cancelOrdersRequest($currency_pair, $side = null, $account = null) + protected function listOrdersRequest($associative_array) { + // unbox the parameters from the associative array + $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; + $status = array_key_exists('status', $associative_array) ? $associative_array['status'] : null; + $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $account = array_key_exists('account', $associative_array) ? $associative_array['account'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + $side = array_key_exists('side', $associative_array) ? $associative_array['side'] : null; + // verify the required parameter 'currency_pair' is set if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $currency_pair when calling cancelOrders' + 'Missing the required parameter $currency_pair when calling listOrders' + ); + } + // verify the required parameter 'status' is set + if ($status === null || (is_array($status) && count($status) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling listOrders' ); } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listOrders, must be bigger than or equal to 1.'); + } + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listOrders, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listOrders, must be bigger than or equal to 1.'); + } + $resourcePath = '/spot/orders'; $formParams = []; @@ -4012,14 +4045,38 @@ protected function cancelOrdersRequest($currency_pair, $side = null, $account = } // query params - if ($side !== null) { - if('form' === 'form' && is_array($side)) { - foreach($side as $key => $value) { + if ($status !== null) { + if('form' === 'form' && is_array($status)) { + foreach($status as $key => $value) { $queryParams[$key] = $value; } } else { - $queryParams['side'] = $side; + $queryParams['status'] = $status; + } + } + + // query params + if ($page !== null) { + if('form' === 'form' && is_array($page)) { + foreach($page as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['page'] = $page; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; } } @@ -4035,6 +4092,42 @@ protected function cancelOrdersRequest($currency_pair, $side = null, $account = } } + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } + } + + // query params + if ($side !== null) { + if('form' === 'form' && is_array($side)) { + foreach($side as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['side'] = $side; + } + } + // body params $_tempBody = null; @@ -4079,7 +4172,7 @@ protected function cancelOrdersRequest($currency_pair, $side = null, $account = } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -4095,7 +4188,7 @@ protected function cancelOrdersRequest($currency_pair, $side = null, $account = $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -4103,36 +4196,36 @@ protected function cancelOrdersRequest($currency_pair, $side = null, $account = } /** - * Operation cancelBatchOrders + * Operation createOrder * - * Cancel a batch of orders with an ID list + * Create an order * - * @param \GateApi\Model\CancelOrder[] $cancel_order cancel_order (required) + * @param \GateApi\Model\Order $order order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\CancelOrderResult[] + * @return \GateApi\Model\Order */ - public function cancelBatchOrders($cancel_order) + public function createOrder($order) { - list($response) = $this->cancelBatchOrdersWithHttpInfo($cancel_order); + list($response) = $this->createOrderWithHttpInfo($order); return $response; } /** - * Operation cancelBatchOrdersWithHttpInfo + * Operation createOrderWithHttpInfo * - * Cancel a batch of orders with an ID list + * Create an order * - * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * @param \GateApi\Model\Order $order (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\CancelOrderResult[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) */ - public function cancelBatchOrdersWithHttpInfo($cancel_order) + public function createOrderWithHttpInfo($order) { - $request = $this->cancelBatchOrdersRequest($cancel_order); + $request = $this->createOrderRequest($order); $options = $this->createHttpClientOption(); try { @@ -4158,7 +4251,7 @@ public function cancelBatchOrdersWithHttpInfo($cancel_order) ); } - $returnType = '\GateApi\Model\CancelOrderResult[]'; + $returnType = '\GateApi\Model\Order'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -4174,18 +4267,18 @@ public function cancelBatchOrdersWithHttpInfo($cancel_order) } /** - * Operation cancelBatchOrdersAsync + * Operation createOrderAsync * - * Cancel a batch of orders with an ID list + * Create an order * - * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * @param \GateApi\Model\Order $order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelBatchOrdersAsync($cancel_order) + public function createOrderAsync($order) { - return $this->cancelBatchOrdersAsyncWithHttpInfo($cancel_order) + return $this->createOrderAsyncWithHttpInfo($order) ->then( function ($response) { return $response[0]; @@ -4194,19 +4287,19 @@ function ($response) { } /** - * Operation cancelBatchOrdersAsyncWithHttpInfo + * Operation createOrderAsyncWithHttpInfo * - * Cancel a batch of orders with an ID list + * Create an order * - * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * @param \GateApi\Model\Order $order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelBatchOrdersAsyncWithHttpInfo($cancel_order) + public function createOrderAsyncWithHttpInfo($order) { - $returnType = '\GateApi\Model\CancelOrderResult[]'; - $request = $this->cancelBatchOrdersRequest($cancel_order); + $returnType = '\GateApi\Model\Order'; + $request = $this->createOrderRequest($order); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4243,23 +4336,23 @@ function ($exception) { } /** - * Create request for operation 'cancelBatchOrders' + * Create request for operation 'createOrder' * - * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * @param \GateApi\Model\Order $order (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function cancelBatchOrdersRequest($cancel_order) + protected function createOrderRequest($order) { - // verify the required parameter 'cancel_order' is set - if ($cancel_order === null || (is_array($cancel_order) && count($cancel_order) === 0)) { + // verify the required parameter 'order' is set + if ($order === null || (is_array($order) && count($order) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $cancel_order when calling cancelBatchOrders' + 'Missing the required parameter $order when calling createOrder' ); } - $resourcePath = '/spot/cancel_batch_orders'; + $resourcePath = '/spot/orders'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4268,8 +4361,8 @@ protected function cancelBatchOrdersRequest($cancel_order) // body params $_tempBody = null; - if (isset($cancel_order)) { - $_tempBody = $cancel_order; + if (isset($order)) { + $_tempBody = $order; } if ($multipart) { @@ -4337,40 +4430,42 @@ protected function cancelBatchOrdersRequest($cancel_order) } /** - * Operation getOrder + * Operation cancelOrders * - * Get a single order + * Cancel all `open` orders in specified currency pair * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * @param string $account Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only + * (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Order + * @return \GateApi\Model\Order[] */ - public function getOrder($order_id, $currency_pair, $account = null) + public function cancelOrders($currency_pair, $side = null, $account = null) { - list($response) = $this->getOrderWithHttpInfo($order_id, $currency_pair, $account); + list($response) = $this->cancelOrdersWithHttpInfo($currency_pair, $side, $account); return $response; } /** - * Operation getOrderWithHttpInfo + * Operation cancelOrdersWithHttpInfo * - * Get a single order + * Cancel all `open` orders in specified currency pair * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * @param string $account Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only + * (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\Order[], HTTP status code, HTTP response headers (array of strings) */ - public function getOrderWithHttpInfo($order_id, $currency_pair, $account = null) + public function cancelOrdersWithHttpInfo($currency_pair, $side = null, $account = null) { - $request = $this->getOrderRequest($order_id, $currency_pair, $account); + $request = $this->cancelOrdersRequest($currency_pair, $side, $account); $options = $this->createHttpClientOption(); try { @@ -4396,7 +4491,7 @@ public function getOrderWithHttpInfo($order_id, $currency_pair, $account = null) ); } - $returnType = '\GateApi\Model\Order'; + $returnType = '\GateApi\Model\Order[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -4412,20 +4507,21 @@ public function getOrderWithHttpInfo($order_id, $currency_pair, $account = null) } /** - * Operation getOrderAsync + * Operation cancelOrdersAsync * - * Get a single order + * Cancel all `open` orders in specified currency pair * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * @param string $account Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only + * (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getOrderAsync($order_id, $currency_pair, $account = null) + public function cancelOrdersAsync($currency_pair, $side = null, $account = null) { - return $this->getOrderAsyncWithHttpInfo($order_id, $currency_pair, $account) + return $this->cancelOrdersAsyncWithHttpInfo($currency_pair, $side, $account) ->then( function ($response) { return $response[0]; @@ -4434,21 +4530,22 @@ function ($response) { } /** - * Operation getOrderAsyncWithHttpInfo + * Operation cancelOrdersAsyncWithHttpInfo * - * Get a single order + * Cancel all `open` orders in specified currency pair * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * @param string $account Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only + * (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getOrderAsyncWithHttpInfo($order_id, $currency_pair, $account = null) + public function cancelOrdersAsyncWithHttpInfo($currency_pair, $side = null, $account = null) { - $returnType = '\GateApi\Model\Order'; - $request = $this->getOrderRequest($order_id, $currency_pair, $account); + $returnType = '\GateApi\Model\Order[]'; + $request = $this->cancelOrdersRequest($currency_pair, $side, $account); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4485,31 +4582,26 @@ function ($exception) { } /** - * Create request for operation 'getOrder' + * Create request for operation 'cancelOrders' * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param string $side All bids or asks. Both included if not specified (optional) + * @param string $account Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only + * (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getOrderRequest($order_id, $currency_pair, $account = null) + protected function cancelOrdersRequest($currency_pair, $side = null, $account = null) { - // verify the required parameter 'order_id' is set - if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $order_id when calling getOrder' - ); - } // verify the required parameter 'currency_pair' is set if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $currency_pair when calling getOrder' + 'Missing the required parameter $currency_pair when calling cancelOrders' ); } - $resourcePath = '/spot/orders/{order_id}'; + $resourcePath = '/spot/orders'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4524,7 +4616,1452 @@ protected function getOrderRequest($order_id, $currency_pair, $account = null) } } else { - $queryParams['currency_pair'] = $currency_pair; + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($side !== null) { + if('form' === 'form' && is_array($side)) { + foreach($side as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['side'] = $side; + } + } + + // query params + if ($account !== null) { + if('form' === 'form' && is_array($account)) { + foreach($account as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['account'] = $account; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelBatchOrders + * + * Cancel a batch of orders with an ID list + * + * @param \GateApi\Model\CancelOrder[] $cancel_order cancel_order (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CancelOrderResult[] + */ + public function cancelBatchOrders($cancel_order) + { + list($response) = $this->cancelBatchOrdersWithHttpInfo($cancel_order); + return $response; + } + + /** + * Operation cancelBatchOrdersWithHttpInfo + * + * Cancel a batch of orders with an ID list + * + * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CancelOrderResult[], HTTP status code, HTTP response headers (array of strings) + */ + public function cancelBatchOrdersWithHttpInfo($cancel_order) + { + $request = $this->cancelBatchOrdersRequest($cancel_order); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CancelOrderResult[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation cancelBatchOrdersAsync + * + * Cancel a batch of orders with an ID list + * + * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelBatchOrdersAsync($cancel_order) + { + return $this->cancelBatchOrdersAsyncWithHttpInfo($cancel_order) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelBatchOrdersAsyncWithHttpInfo + * + * Cancel a batch of orders with an ID list + * + * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelBatchOrdersAsyncWithHttpInfo($cancel_order) + { + $returnType = '\GateApi\Model\CancelOrderResult[]'; + $request = $this->cancelBatchOrdersRequest($cancel_order); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelBatchOrders' + * + * @param \GateApi\Model\CancelOrder[] $cancel_order (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cancelBatchOrdersRequest($cancel_order) + { + // verify the required parameter 'cancel_order' is set + if ($cancel_order === null || (is_array($cancel_order) && count($cancel_order) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $cancel_order when calling cancelBatchOrders' + ); + } + + $resourcePath = '/spot/cancel_batch_orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($cancel_order)) { + $_tempBody = $cancel_order; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOrder + * + * Get a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\Order + */ + public function getOrder($order_id, $currency_pair, $account = null) + { + list($response) = $this->getOrderWithHttpInfo($order_id, $currency_pair, $account); + return $response; + } + + /** + * Operation getOrderWithHttpInfo + * + * Get a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrderWithHttpInfo($order_id, $currency_pair, $account = null) + { + $request = $this->getOrderRequest($order_id, $currency_pair, $account); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\Order'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getOrderAsync + * + * Get a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrderAsync($order_id, $currency_pair, $account = null) + { + return $this->getOrderAsyncWithHttpInfo($order_id, $currency_pair, $account) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrderAsyncWithHttpInfo + * + * Get a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrderAsyncWithHttpInfo($order_id, $currency_pair, $account = null) + { + $returnType = '\GateApi\Model\Order'; + $request = $this->getOrderRequest($order_id, $currency_pair, $account); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOrder' + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getOrderRequest($order_id, $currency_pair, $account = null) + { + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling getOrder' + ); + } + // verify the required parameter 'currency_pair' is set + if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency_pair when calling getOrder' + ); + } + + $resourcePath = '/spot/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($account !== null) { + if('form' === 'form' && is_array($account)) { + foreach($account as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['account'] = $account; + } + } + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelOrder + * + * Cancel a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\Order + */ + public function cancelOrder($order_id, $currency_pair, $account = null) + { + list($response) = $this->cancelOrderWithHttpInfo($order_id, $currency_pair, $account); + return $response; + } + + /** + * Operation cancelOrderWithHttpInfo + * + * Cancel a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelOrderWithHttpInfo($order_id, $currency_pair, $account = null) + { + $request = $this->cancelOrderRequest($order_id, $currency_pair, $account); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\Order'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation cancelOrderAsync + * + * Cancel a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelOrderAsync($order_id, $currency_pair, $account = null) + { + return $this->cancelOrderAsyncWithHttpInfo($order_id, $currency_pair, $account) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelOrderAsyncWithHttpInfo + * + * Cancel a single order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelOrderAsyncWithHttpInfo($order_id, $currency_pair, $account = null) + { + $returnType = '\GateApi\Model\Order'; + $request = $this->cancelOrderRequest($order_id, $currency_pair, $account); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelOrder' + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cancelOrderRequest($order_id, $currency_pair, $account = null) + { + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling cancelOrder' + ); + } + // verify the required parameter 'currency_pair' is set + if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency_pair when calling cancelOrder' + ); + } + + $resourcePath = '/spot/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($account !== null) { + if('form' === 'form' && is_array($account)) { + foreach($account as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['account'] = $account; + } + } + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation amendOrder + * + * Amend an order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param \GateApi\Model\OrderPatch $order_patch order_patch (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\Order + */ + public function amendOrder($order_id, $currency_pair, $order_patch, $account = null) + { + list($response) = $this->amendOrderWithHttpInfo($order_id, $currency_pair, $order_patch, $account); + return $response; + } + + /** + * Operation amendOrderWithHttpInfo + * + * Amend an order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param \GateApi\Model\OrderPatch $order_patch (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) + */ + public function amendOrderWithHttpInfo($order_id, $currency_pair, $order_patch, $account = null) + { + $request = $this->amendOrderRequest($order_id, $currency_pair, $order_patch, $account); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\Order'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation amendOrderAsync + * + * Amend an order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param \GateApi\Model\OrderPatch $order_patch (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function amendOrderAsync($order_id, $currency_pair, $order_patch, $account = null) + { + return $this->amendOrderAsyncWithHttpInfo($order_id, $currency_pair, $order_patch, $account) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation amendOrderAsyncWithHttpInfo + * + * Amend an order + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param \GateApi\Model\OrderPatch $order_patch (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function amendOrderAsyncWithHttpInfo($order_id, $currency_pair, $order_patch, $account = null) + { + $returnType = '\GateApi\Model\Order'; + $request = $this->amendOrderRequest($order_id, $currency_pair, $order_patch, $account); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'amendOrder' + * + * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 1 hour after the end of the order. After that, only order ID is accepted. (required) + * @param string $currency_pair Currency pair (required) + * @param \GateApi\Model\OrderPatch $order_patch (required) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function amendOrderRequest($order_id, $currency_pair, $order_patch, $account = null) + { + // verify the required parameter 'order_id' is set + if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling amendOrder' + ); + } + // verify the required parameter 'currency_pair' is set + if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency_pair when calling amendOrder' + ); + } + // verify the required parameter 'order_patch' is set + if ($order_patch === null || (is_array($order_patch) && count($order_patch) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $order_patch when calling amendOrder' + ); + } + + $resourcePath = '/spot/orders/{order_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($account !== null) { + if('form' === 'form' && is_array($account)) { + foreach($account as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['account'] = $account; + } + } + + // path params + if ($order_id !== null) { + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($order_patch)) { + $_tempBody = $order_patch; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('PATCH', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMyTrades + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * @param string $order_id Filter trades with specified order ID. `currency_pair` is also required if this field is present (optional) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\Trade[] + */ + public function listMyTrades($associative_array) + { + list($response) = $this->listMyTradesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listMyTradesWithHttpInfo + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * @param string $order_id Filter trades with specified order ID. `currency_pair` is also required if this field is present (optional) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\Trade[], HTTP status code, HTTP response headers (array of strings) + */ + public function listMyTradesWithHttpInfo($associative_array) + { + $request = $this->listMyTradesRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\Trade[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listMyTradesAsync + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * @param string $order_id Filter trades with specified order ID. `currency_pair` is also required if this field is present (optional) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMyTradesAsync($associative_array) + { + return $this->listMyTradesAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMyTradesAsyncWithHttpInfo + * + * List personal trading history + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * @param string $order_id Filter trades with specified order ID. `currency_pair` is also required if this field is present (optional) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMyTradesAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\Trade[]'; + $request = $this->listMyTradesRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listMyTrades' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Retrieve results with specified currency pair (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) + * @param int $page Page number (optional, default to 1) + * @param string $order_id Filter trades with specified order ID. `currency_pair` is also required if this field is present (optional) + * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only (optional) + * @param int $from Start timestamp of the query (optional) + * @param int $to Time range ending, default to current time (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listMyTradesRequest($associative_array) + { + // unbox the parameters from the associative array + $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; + $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; + $order_id = array_key_exists('order_id', $associative_array) ? $associative_array['order_id'] : null; + $account = array_key_exists('account', $associative_array) ? $associative_array['account'] : null; + $from = array_key_exists('from', $associative_array) ? $associative_array['from'] : null; + $to = array_key_exists('to', $associative_array) ? $associative_array['to'] : null; + + if ($limit !== null && $limit > 1000) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listMyTrades, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listMyTrades, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listMyTrades, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/spot/my_trades'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // query params + if ($page !== null) { + if('form' === 'form' && is_array($page)) { + foreach($page as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['page'] = $page; + } + } + + // query params + if ($order_id !== null) { + if('form' === 'form' && is_array($order_id)) { + foreach($order_id as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['order_id'] = $order_id; } } @@ -4540,13 +6077,28 @@ protected function getOrderRequest($order_id, $currency_pair, $account = null) } } - // path params - if ($order_id !== null) { - $resourcePath = str_replace( - '{' . 'order_id' . '}', - ObjectSerializer::toPathValue($order_id), - $resourcePath - ); + // query params + if ($from !== null) { + if('form' === 'form' && is_array($from)) { + foreach($from as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['from'] = $from; + } + } + + // query params + if ($to !== null) { + if('form' === 'form' && is_array($to)) { + foreach($to as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['to'] = $to; + } } // body params @@ -4617,40 +6169,32 @@ protected function getOrderRequest($order_id, $currency_pair, $account = null) } /** - * Operation cancelOrder + * Operation getSystemTime * - * Cancel a single order - * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) - * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * Get server current time * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Order + * @return \GateApi\Model\SystemTime */ - public function cancelOrder($order_id, $currency_pair, $account = null) + public function getSystemTime() { - list($response) = $this->cancelOrderWithHttpInfo($order_id, $currency_pair, $account); + list($response) = $this->getSystemTimeWithHttpInfo(); return $response; } /** - * Operation cancelOrderWithHttpInfo - * - * Cancel a single order + * Operation getSystemTimeWithHttpInfo * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) - * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * Get server current time * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Order, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\SystemTime, HTTP status code, HTTP response headers (array of strings) */ - public function cancelOrderWithHttpInfo($order_id, $currency_pair, $account = null) + public function getSystemTimeWithHttpInfo() { - $request = $this->cancelOrderRequest($order_id, $currency_pair, $account); + $request = $this->getSystemTimeRequest(); $options = $this->createHttpClientOption(); try { @@ -4676,7 +6220,7 @@ public function cancelOrderWithHttpInfo($order_id, $currency_pair, $account = nu ); } - $returnType = '\GateApi\Model\Order'; + $returnType = '\GateApi\Model\SystemTime'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -4692,20 +6236,16 @@ public function cancelOrderWithHttpInfo($order_id, $currency_pair, $account = nu } /** - * Operation cancelOrderAsync - * - * Cancel a single order + * Operation getSystemTimeAsync * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) - * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * Get server current time * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelOrderAsync($order_id, $currency_pair, $account = null) + public function getSystemTimeAsync() { - return $this->cancelOrderAsyncWithHttpInfo($order_id, $currency_pair, $account) + return $this->getSystemTimeAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -4714,21 +6254,17 @@ function ($response) { } /** - * Operation cancelOrderAsyncWithHttpInfo - * - * Cancel a single order + * Operation getSystemTimeAsyncWithHttpInfo * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) - * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * Get server current time * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelOrderAsyncWithHttpInfo($order_id, $currency_pair, $account = null) + public function getSystemTimeAsyncWithHttpInfo() { - $returnType = '\GateApi\Model\Order'; - $request = $this->cancelOrderRequest($order_id, $currency_pair, $account); + $returnType = '\GateApi\Model\SystemTime'; + $request = $this->getSystemTimeRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4765,70 +6301,21 @@ function ($exception) { } /** - * Create request for operation 'cancelOrder' - * - * @param string $order_id Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) - * @param string $currency_pair Currency pair (required) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * Create request for operation 'getSystemTime' * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function cancelOrderRequest($order_id, $currency_pair, $account = null) + protected function getSystemTimeRequest() { - // verify the required parameter 'order_id' is set - if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $order_id when calling cancelOrder' - ); - } - // verify the required parameter 'currency_pair' is set - if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $currency_pair when calling cancelOrder' - ); - } - $resourcePath = '/spot/orders/{order_id}'; + $resourcePath = '/spot/time'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($currency_pair !== null) { - if('form' === 'form' && is_array($currency_pair)) { - foreach($currency_pair as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['currency_pair'] = $currency_pair; - } - } - - // query params - if ($account !== null) { - if('form' === 'form' && is_array($account)) { - foreach($account as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['account'] = $account; - } - } - - // path params - if ($order_id !== null) { - $resourcePath = str_replace( - '{' . 'order_id' . '}', - ObjectSerializer::toPathValue($order_id), - $resourcePath - ); - } - // body params $_tempBody = null; @@ -4872,9 +6359,6 @@ protected function cancelOrderRequest($order_id, $currency_pair, $account = null } } - // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); - $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -4889,7 +6373,7 @@ protected function cancelOrderRequest($order_id, $currency_pair, $account = null $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -4897,48 +6381,36 @@ protected function cancelOrderRequest($order_id, $currency_pair, $account = null } /** - * Operation listMyTrades - * - * List personal trading history + * Operation countdownCancelAllSpot * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $page Page number (optional, default to 1) - * @param string $order_id List all trades of specified order (optional) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\CountdownCancelAllSpotTask $countdown_cancel_all_spot_task countdown_cancel_all_spot_task (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\Trade[] + * @return \GateApi\Model\TriggerTime */ - public function listMyTrades($associative_array) + public function countdownCancelAllSpot($countdown_cancel_all_spot_task) { - list($response) = $this->listMyTradesWithHttpInfo($associative_array); + list($response) = $this->countdownCancelAllSpotWithHttpInfo($countdown_cancel_all_spot_task); return $response; } /** - * Operation listMyTradesWithHttpInfo + * Operation countdownCancelAllSpotWithHttpInfo * - * List personal trading history - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $page Page number (optional, default to 1) - * @param string $order_id List all trades of specified order (optional) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\CountdownCancelAllSpotTask $countdown_cancel_all_spot_task (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\Trade[], HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\TriggerTime, HTTP status code, HTTP response headers (array of strings) */ - public function listMyTradesWithHttpInfo($associative_array) + public function countdownCancelAllSpotWithHttpInfo($countdown_cancel_all_spot_task) { - $request = $this->listMyTradesRequest($associative_array); + $request = $this->countdownCancelAllSpotRequest($countdown_cancel_all_spot_task); $options = $this->createHttpClientOption(); try { @@ -4964,7 +6436,7 @@ public function listMyTradesWithHttpInfo($associative_array) ); } - $returnType = '\GateApi\Model\Trade[]'; + $returnType = '\GateApi\Model\TriggerTime'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -4980,24 +6452,18 @@ public function listMyTradesWithHttpInfo($associative_array) } /** - * Operation listMyTradesAsync - * - * List personal trading history + * Operation countdownCancelAllSpotAsync * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $page Page number (optional, default to 1) - * @param string $order_id List all trades of specified order (optional) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\CountdownCancelAllSpotTask $countdown_cancel_all_spot_task (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listMyTradesAsync($associative_array) + public function countdownCancelAllSpotAsync($countdown_cancel_all_spot_task) { - return $this->listMyTradesAsyncWithHttpInfo($associative_array) + return $this->countdownCancelAllSpotAsyncWithHttpInfo($countdown_cancel_all_spot_task) ->then( function ($response) { return $response[0]; @@ -5006,25 +6472,19 @@ function ($response) { } /** - * Operation listMyTradesAsyncWithHttpInfo - * - * List personal trading history + * Operation countdownCancelAllSpotAsyncWithHttpInfo * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Countdown cancel orders * - * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $page Page number (optional, default to 1) - * @param string $order_id List all trades of specified order (optional) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\CountdownCancelAllSpotTask $countdown_cancel_all_spot_task (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listMyTradesAsyncWithHttpInfo($associative_array) + public function countdownCancelAllSpotAsyncWithHttpInfo($countdown_cancel_all_spot_task) { - $returnType = '\GateApi\Model\Trade[]'; - $request = $this->listMyTradesRequest($associative_array); + $returnType = '\GateApi\Model\TriggerTime'; + $request = $this->countdownCancelAllSpotRequest($countdown_cancel_all_spot_task); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5061,115 +6521,34 @@ function ($exception) { } /** - * Create request for operation 'listMyTrades' - * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Create request for operation 'countdownCancelAllSpot' * - * @param string $currency_pair Currency pair (required) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) - * @param int $page Page number (optional, default to 1) - * @param string $order_id List all trades of specified order (optional) - * @param string $account Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) + * @param \GateApi\Model\CountdownCancelAllSpotTask $countdown_cancel_all_spot_task (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function listMyTradesRequest($associative_array) + protected function countdownCancelAllSpotRequest($countdown_cancel_all_spot_task) { - // unbox the parameters from the associative array - $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; - $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : 100; - $page = array_key_exists('page', $associative_array) ? $associative_array['page'] : 1; - $order_id = array_key_exists('order_id', $associative_array) ? $associative_array['order_id'] : null; - $account = array_key_exists('account', $associative_array) ? $associative_array['account'] : null; - - // verify the required parameter 'currency_pair' is set - if ($currency_pair === null || (is_array($currency_pair) && count($currency_pair) === 0)) { + // verify the required parameter 'countdown_cancel_all_spot_task' is set + if ($countdown_cancel_all_spot_task === null || (is_array($countdown_cancel_all_spot_task) && count($countdown_cancel_all_spot_task) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $currency_pair when calling listMyTrades' + 'Missing the required parameter $countdown_cancel_all_spot_task when calling countdownCancelAllSpot' ); } - if ($limit !== null && $limit > 1000) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listMyTrades, must be smaller than or equal to 1000.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling SpotApi.listMyTrades, must be bigger than or equal to 1.'); - } - - if ($page !== null && $page < 1) { - throw new \InvalidArgumentException('invalid value for "$page" when calling SpotApi.listMyTrades, must be bigger than or equal to 1.'); - } - - $resourcePath = '/spot/my_trades'; + $resourcePath = '/spot/countdown_cancel_all'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - if ($currency_pair !== null) { - if('form' === 'form' && is_array($currency_pair)) { - foreach($currency_pair as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['currency_pair'] = $currency_pair; - } - } - - // query params - if ($limit !== null) { - if('form' === 'form' && is_array($limit)) { - foreach($limit as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['limit'] = $limit; - } - } - - // query params - if ($page !== null) { - if('form' === 'form' && is_array($page)) { - foreach($page as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['page'] = $page; - } - } - - // query params - if ($order_id !== null) { - if('form' === 'form' && is_array($order_id)) { - foreach($order_id as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['order_id'] = $order_id; - } - } - - // query params - if ($account !== null) { - if('form' === 'form' && is_array($account)) { - foreach($account as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['account'] = $account; - } - } - // body params $_tempBody = null; + if (isset($countdown_cancel_all_spot_task)) { + $_tempBody = $countdown_cancel_all_spot_task; + } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( @@ -5178,7 +6557,7 @@ protected function listMyTradesRequest($associative_array) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } @@ -5212,7 +6591,7 @@ protected function listMyTradesRequest($associative_array) } // this endpoint requires Gate APIv4 authentication - $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); $headers = array_merge($headers, $signHeaders); $defaultHeaders = []; @@ -5228,7 +6607,7 @@ protected function listMyTradesRequest($associative_array) $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -5242,10 +6621,10 @@ protected function listMyTradesRequest($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -5265,10 +6644,10 @@ public function listSpotPriceTriggeredOrders($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -5325,10 +6704,10 @@ public function listSpotPriceTriggeredOrdersWithHttpInfo($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -5351,10 +6730,10 @@ function ($response) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -5404,10 +6783,10 @@ function ($exception) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $status List orders based on status (required) + * @param string $status Only list the orders with this status (required) * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -5814,7 +7193,7 @@ protected function createSpotPriceTriggeredOrderRequest($spot_price_triggered_or * Cancel all open orders * * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5832,7 +7211,7 @@ public function cancelSpotPriceTriggeredOrderList($market = null, $account = nul * Cancel all open orders * * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -5887,7 +7266,7 @@ public function cancelSpotPriceTriggeredOrderListWithHttpInfo($market = null, $a * Cancel all open orders * * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -5908,7 +7287,7 @@ function ($response) { * Cancel all open orders * * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -5956,7 +7335,7 @@ function ($exception) { * Create request for operation 'cancelSpotPriceTriggeredOrderList' * * @param string $market Currency pair (optional) - * @param string $account Trading account (optional) + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -6065,9 +7444,9 @@ protected function cancelSpotPriceTriggeredOrderListRequest($market = null, $acc /** * Operation getSpotPriceTriggeredOrder * - * Get a single order + * Get a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -6082,9 +7461,9 @@ public function getSpotPriceTriggeredOrder($order_id) /** * Operation getSpotPriceTriggeredOrderWithHttpInfo * - * Get a single order + * Get a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -6136,9 +7515,9 @@ public function getSpotPriceTriggeredOrderWithHttpInfo($order_id) /** * Operation getSpotPriceTriggeredOrderAsync * - * Get a single order + * Get a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -6156,9 +7535,9 @@ function ($response) { /** * Operation getSpotPriceTriggeredOrderAsyncWithHttpInfo * - * Get a single order + * Get a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -6205,7 +7584,7 @@ function ($exception) { /** * Create request for operation 'getSpotPriceTriggeredOrder' * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -6305,9 +7684,9 @@ protected function getSpotPriceTriggeredOrderRequest($order_id) /** * Operation cancelSpotPriceTriggeredOrder * - * Cancel a single order + * cancel a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -6322,9 +7701,9 @@ public function cancelSpotPriceTriggeredOrder($order_id) /** * Operation cancelSpotPriceTriggeredOrderWithHttpInfo * - * Cancel a single order + * cancel a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -6376,9 +7755,9 @@ public function cancelSpotPriceTriggeredOrderWithHttpInfo($order_id) /** * Operation cancelSpotPriceTriggeredOrderAsync * - * Cancel a single order + * cancel a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -6396,9 +7775,9 @@ function ($response) { /** * Operation cancelSpotPriceTriggeredOrderAsyncWithHttpInfo * - * Cancel a single order + * cancel a price-triggered order * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -6445,7 +7824,7 @@ function ($exception) { /** * Create request for operation 'cancelSpotPriceTriggeredOrder' * - * @param string $order_id ID returned on order successfully being created (required) + * @param string $order_id Retrieve the data of the order with the specified ID (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request diff --git a/src/Api/SubAccountApi.php b/src/Api/SubAccountApi.php new file mode 100644 index 0000000..3473c09 --- /dev/null +++ b/src/Api/SubAccountApi.php @@ -0,0 +1,2495 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $host_index; + } + + /** + * Set the host index + * + * @param int Host index (required) + */ + public function setHostIndex($host_index) + { + $this->hostIndex = $host_index; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation listSubAccounts + * + * List sub-accounts + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccount[] + */ + public function listSubAccounts() + { + list($response) = $this->listSubAccountsWithHttpInfo(); + return $response; + } + + /** + * Operation listSubAccountsWithHttpInfo + * + * List sub-accounts + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccount[], HTTP status code, HTTP response headers (array of strings) + */ + public function listSubAccountsWithHttpInfo() + { + $request = $this->listSubAccountsRequest(); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccount[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listSubAccountsAsync + * + * List sub-accounts + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountsAsync() + { + return $this->listSubAccountsAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listSubAccountsAsyncWithHttpInfo + * + * List sub-accounts + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountsAsyncWithHttpInfo() + { + $returnType = '\GateApi\Model\SubAccount[]'; + $request = $this->listSubAccountsRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listSubAccounts' + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listSubAccountsRequest() + { + + $resourcePath = '/sub_accounts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createSubAccounts + * + * Create a new sub-account + * + * @param \GateApi\Model\SubAccount $sub_account sub_account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccount + */ + public function createSubAccounts($sub_account) + { + list($response) = $this->createSubAccountsWithHttpInfo($sub_account); + return $response; + } + + /** + * Operation createSubAccountsWithHttpInfo + * + * Create a new sub-account + * + * @param \GateApi\Model\SubAccount $sub_account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccount, HTTP status code, HTTP response headers (array of strings) + */ + public function createSubAccountsWithHttpInfo($sub_account) + { + $request = $this->createSubAccountsRequest($sub_account); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccount'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation createSubAccountsAsync + * + * Create a new sub-account + * + * @param \GateApi\Model\SubAccount $sub_account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSubAccountsAsync($sub_account) + { + return $this->createSubAccountsAsyncWithHttpInfo($sub_account) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSubAccountsAsyncWithHttpInfo + * + * Create a new sub-account + * + * @param \GateApi\Model\SubAccount $sub_account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSubAccountsAsyncWithHttpInfo($sub_account) + { + $returnType = '\GateApi\Model\SubAccount'; + $request = $this->createSubAccountsRequest($sub_account); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createSubAccounts' + * + * @param \GateApi\Model\SubAccount $sub_account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createSubAccountsRequest($sub_account) + { + // verify the required parameter 'sub_account' is set + if ($sub_account === null || (is_array($sub_account) && count($sub_account) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sub_account when calling createSubAccounts' + ); + } + + $resourcePath = '/sub_accounts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($sub_account)) { + $_tempBody = $sub_account; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubAccount + * + * Get the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccount + */ + public function getSubAccount($user_id) + { + list($response) = $this->getSubAccountWithHttpInfo($user_id); + return $response; + } + + /** + * Operation getSubAccountWithHttpInfo + * + * Get the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccount, HTTP status code, HTTP response headers (array of strings) + */ + public function getSubAccountWithHttpInfo($user_id) + { + $request = $this->getSubAccountRequest($user_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccount'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getSubAccountAsync + * + * Get the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubAccountAsync($user_id) + { + return $this->getSubAccountAsyncWithHttpInfo($user_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubAccountAsyncWithHttpInfo + * + * Get the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubAccountAsyncWithHttpInfo($user_id) + { + $returnType = '\GateApi\Model\SubAccount'; + $request = $this->getSubAccountRequest($user_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubAccount' + * + * @param int $user_id Sub-account user id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSubAccountRequest($user_id) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling getSubAccount' + ); + } + + $resourcePath = '/sub_accounts/{user_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listSubAccountKeys + * + * List all API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccountKey[] + */ + public function listSubAccountKeys($user_id) + { + list($response) = $this->listSubAccountKeysWithHttpInfo($user_id); + return $response; + } + + /** + * Operation listSubAccountKeysWithHttpInfo + * + * List all API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccountKey[], HTTP status code, HTTP response headers (array of strings) + */ + public function listSubAccountKeysWithHttpInfo($user_id) + { + $request = $this->listSubAccountKeysRequest($user_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccountKey[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listSubAccountKeysAsync + * + * List all API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountKeysAsync($user_id) + { + return $this->listSubAccountKeysAsyncWithHttpInfo($user_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listSubAccountKeysAsyncWithHttpInfo + * + * List all API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountKeysAsyncWithHttpInfo($user_id) + { + $returnType = '\GateApi\Model\SubAccountKey[]'; + $request = $this->listSubAccountKeysRequest($user_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listSubAccountKeys' + * + * @param int $user_id Sub-account user id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listSubAccountKeysRequest($user_id) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling listSubAccountKeys' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/keys'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createSubAccountKeys + * + * Create API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key sub_account_key (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccountKey[] + */ + public function createSubAccountKeys($user_id, $sub_account_key) + { + list($response) = $this->createSubAccountKeysWithHttpInfo($user_id, $sub_account_key); + return $response; + } + + /** + * Operation createSubAccountKeysWithHttpInfo + * + * Create API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccountKey[], HTTP status code, HTTP response headers (array of strings) + */ + public function createSubAccountKeysWithHttpInfo($user_id, $sub_account_key) + { + $request = $this->createSubAccountKeysRequest($user_id, $sub_account_key); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccountKey[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation createSubAccountKeysAsync + * + * Create API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSubAccountKeysAsync($user_id, $sub_account_key) + { + return $this->createSubAccountKeysAsyncWithHttpInfo($user_id, $sub_account_key) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSubAccountKeysAsyncWithHttpInfo + * + * Create API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSubAccountKeysAsyncWithHttpInfo($user_id, $sub_account_key) + { + $returnType = '\GateApi\Model\SubAccountKey[]'; + $request = $this->createSubAccountKeysRequest($user_id, $sub_account_key); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createSubAccountKeys' + * + * @param int $user_id Sub-account user id (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createSubAccountKeysRequest($user_id, $sub_account_key) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling createSubAccountKeys' + ); + } + // verify the required parameter 'sub_account_key' is set + if ($sub_account_key === null || (is_array($sub_account_key) && count($sub_account_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sub_account_key when calling createSubAccountKeys' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/keys'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($sub_account_key)) { + $_tempBody = $sub_account_key; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSubAccountKey + * + * Get the API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccountKey + */ + public function getSubAccountKey($user_id, $key) + { + list($response) = $this->getSubAccountKeyWithHttpInfo($user_id, $key); + return $response; + } + + /** + * Operation getSubAccountKeyWithHttpInfo + * + * Get the API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccountKey, HTTP status code, HTTP response headers (array of strings) + */ + public function getSubAccountKeyWithHttpInfo($user_id, $key) + { + $request = $this->getSubAccountKeyRequest($user_id, $key); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccountKey'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getSubAccountKeyAsync + * + * Get the API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubAccountKeyAsync($user_id, $key) + { + return $this->getSubAccountKeyAsyncWithHttpInfo($user_id, $key) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSubAccountKeyAsyncWithHttpInfo + * + * Get the API Key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSubAccountKeyAsyncWithHttpInfo($user_id, $key) + { + $returnType = '\GateApi\Model\SubAccountKey'; + $request = $this->getSubAccountKeyRequest($user_id, $key); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSubAccountKey' + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSubAccountKeyRequest($user_id, $key) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling getSubAccountKey' + ); + } + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling getSubAccountKey' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/keys/{key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSubAccountKeys + * + * Update API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key sub_account_key (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateSubAccountKeys($user_id, $key, $sub_account_key) + { + $this->updateSubAccountKeysWithHttpInfo($user_id, $key, $sub_account_key); + } + + /** + * Operation updateSubAccountKeysWithHttpInfo + * + * Update API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSubAccountKeysWithHttpInfo($user_id, $key, $sub_account_key) + { + $request = $this->updateSubAccountKeysRequest($user_id, $key, $sub_account_key); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + return [null, $statusCode, $response->getHeaders()]; + } + + /** + * Operation updateSubAccountKeysAsync + * + * Update API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSubAccountKeysAsync($user_id, $key, $sub_account_key) + { + return $this->updateSubAccountKeysAsyncWithHttpInfo($user_id, $key, $sub_account_key) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateSubAccountKeysAsyncWithHttpInfo + * + * Update API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSubAccountKeysAsyncWithHttpInfo($user_id, $key, $sub_account_key) + { + $returnType = ''; + $request = $this->updateSubAccountKeysRequest($user_id, $key, $sub_account_key); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateSubAccountKeys' + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * @param \GateApi\Model\SubAccountKey $sub_account_key (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateSubAccountKeysRequest($user_id, $key, $sub_account_key) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling updateSubAccountKeys' + ); + } + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling updateSubAccountKeys' + ); + } + // verify the required parameter 'sub_account_key' is set + if ($sub_account_key === null || (is_array($sub_account_key) && count($sub_account_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sub_account_key when calling updateSubAccountKeys' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/keys/{key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($sub_account_key)) { + $_tempBody = $sub_account_key; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('PUT', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSubAccountKeys + * + * Delete API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSubAccountKeys($user_id, $key) + { + $this->deleteSubAccountKeysWithHttpInfo($user_id, $key); + } + + /** + * Operation deleteSubAccountKeysWithHttpInfo + * + * Delete API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSubAccountKeysWithHttpInfo($user_id, $key) + { + $request = $this->deleteSubAccountKeysRequest($user_id, $key); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + return [null, $statusCode, $response->getHeaders()]; + } + + /** + * Operation deleteSubAccountKeysAsync + * + * Delete API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSubAccountKeysAsync($user_id, $key) + { + return $this->deleteSubAccountKeysAsyncWithHttpInfo($user_id, $key) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSubAccountKeysAsyncWithHttpInfo + * + * Delete API key of the sub-account + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSubAccountKeysAsyncWithHttpInfo($user_id, $key) + { + $returnType = ''; + $request = $this->deleteSubAccountKeysRequest($user_id, $key); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSubAccountKeys' + * + * @param int $user_id Sub-account user id (required) + * @param string $key The API Key of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteSubAccountKeysRequest($user_id, $key) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling deleteSubAccountKeys' + ); + } + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling deleteSubAccountKeys' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/keys/{key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('DELETE', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation lockSubAccount + * + * Lock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function lockSubAccount($user_id) + { + $this->lockSubAccountWithHttpInfo($user_id); + } + + /** + * Operation lockSubAccountWithHttpInfo + * + * Lock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function lockSubAccountWithHttpInfo($user_id) + { + $request = $this->lockSubAccountRequest($user_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + return [null, $statusCode, $response->getHeaders()]; + } + + /** + * Operation lockSubAccountAsync + * + * Lock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function lockSubAccountAsync($user_id) + { + return $this->lockSubAccountAsyncWithHttpInfo($user_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation lockSubAccountAsyncWithHttpInfo + * + * Lock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function lockSubAccountAsyncWithHttpInfo($user_id) + { + $returnType = ''; + $request = $this->lockSubAccountRequest($user_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'lockSubAccount' + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function lockSubAccountRequest($user_id) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling lockSubAccount' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/lock'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation unlockSubAccount + * + * Unlock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function unlockSubAccount($user_id) + { + $this->unlockSubAccountWithHttpInfo($user_id); + } + + /** + * Operation unlockSubAccountWithHttpInfo + * + * Unlock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function unlockSubAccountWithHttpInfo($user_id) + { + $request = $this->unlockSubAccountRequest($user_id); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + return [null, $statusCode, $response->getHeaders()]; + } + + /** + * Operation unlockSubAccountAsync + * + * Unlock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function unlockSubAccountAsync($user_id) + { + return $this->unlockSubAccountAsyncWithHttpInfo($user_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation unlockSubAccountAsyncWithHttpInfo + * + * Unlock the sub-account + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function unlockSubAccountAsyncWithHttpInfo($user_id) + { + $returnType = ''; + $request = $this->unlockSubAccountRequest($user_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'unlockSubAccount' + * + * @param int $user_id The user id of the sub-account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function unlockSubAccountRequest($user_id) + { + // verify the required parameter 'user_id' is set + if ($user_id === null || (is_array($user_id) && count($user_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_id when calling unlockSubAccount' + ); + } + + $resourcePath = '/sub_accounts/{user_id}/unlock'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // path params + if ($user_id !== null) { + $resourcePath = str_replace( + '{' . 'user_id' . '}', + ObjectSerializer::toPathValue($user_id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Api/WalletApi.php b/src/Api/WalletApi.php index 2cb046e..6e15404 100644 --- a/src/Api/WalletApi.php +++ b/src/Api/WalletApi.php @@ -113,6 +113,246 @@ public function getConfig() return $this->config; } + /** + * Operation listCurrencyChains + * + * List chains supported for specified currency + * + * @param string $currency Currency name (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\CurrencyChain[] + */ + public function listCurrencyChains($currency) + { + list($response) = $this->listCurrencyChainsWithHttpInfo($currency); + return $response; + } + + /** + * Operation listCurrencyChainsWithHttpInfo + * + * List chains supported for specified currency + * + * @param string $currency Currency name (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\CurrencyChain[], HTTP status code, HTTP response headers (array of strings) + */ + public function listCurrencyChainsWithHttpInfo($currency) + { + $request = $this->listCurrencyChainsRequest($currency); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\CurrencyChain[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listCurrencyChainsAsync + * + * List chains supported for specified currency + * + * @param string $currency Currency name (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCurrencyChainsAsync($currency) + { + return $this->listCurrencyChainsAsyncWithHttpInfo($currency) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCurrencyChainsAsyncWithHttpInfo + * + * List chains supported for specified currency + * + * @param string $currency Currency name (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCurrencyChainsAsyncWithHttpInfo($currency) + { + $returnType = '\GateApi\Model\CurrencyChain[]'; + $request = $this->listCurrencyChainsRequest($currency); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCurrencyChains' + * + * @param string $currency Currency name (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listCurrencyChainsRequest($currency) + { + // verify the required parameter 'currency' is set + if ($currency === null || (is_array($currency) && count($currency) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency when calling listCurrencyChains' + ); + } + + $resourcePath = '/wallet/currency_chains'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation getDepositAddress * @@ -366,7 +606,7 @@ protected function getDepositAddressRequest($currency) * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -389,7 +629,7 @@ public function listWithdrawals($associative_array) * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -449,7 +689,7 @@ public function listWithdrawalsWithHttpInfo($associative_array) * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -475,7 +715,7 @@ function ($response) { * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -528,7 +768,7 @@ function ($exception) { * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -699,7 +939,7 @@ protected function listWithdrawalsRequest($associative_array) * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -722,7 +962,7 @@ public function listDeposits($associative_array) * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -782,7 +1022,7 @@ public function listDepositsWithHttpInfo($associative_array) * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -808,7 +1048,7 @@ function ($response) { * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -861,7 +1101,7 @@ function ($exception) { * @param string $currency Filter by currency. Return all currency records if not specified (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -1031,11 +1271,12 @@ protected function listDepositsRequest($associative_array) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return void + * @return \GateApi\Model\TransactionID */ public function transfer($transfer) { - $this->transferWithHttpInfo($transfer); + list($response) = $this->transferWithHttpInfo($transfer); + return $response; } /** @@ -1047,7 +1288,7 @@ public function transfer($transfer) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\TransactionID, HTTP status code, HTTP response headers (array of strings) */ public function transferWithHttpInfo($transfer) { @@ -1077,7 +1318,19 @@ public function transferWithHttpInfo($transfer) ); } - return [null, $statusCode, $response->getHeaders()]; + $returnType = '\GateApi\Model\TransactionID'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } /** @@ -1112,14 +1365,25 @@ function ($response) { */ public function transferAsyncWithHttpInfo($transfer) { - $returnType = ''; + $returnType = '\GateApi\Model\TransactionID'; $request = $this->transferRequest($transfer); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -1170,11 +1434,11 @@ protected function transferRequest($transfer) if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( - [] + ['application/json'] ); } else { $headers = $this->headerSelector->selectHeaders( - [], + ['application/json'], ['application/json'] ); } @@ -1235,14 +1499,14 @@ protected function transferRequest($transfer) /** * Operation listSubAccountTransfers * - * Transfer records between main and sub accounts + * Retrieve transfer records between main and sub accounts * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -1258,14 +1522,14 @@ public function listSubAccountTransfers($associative_array) /** * Operation listSubAccountTransfersWithHttpInfo * - * Transfer records between main and sub accounts + * Retrieve transfer records between main and sub accounts * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \GateApi\ApiException on non-2xx response @@ -1318,14 +1582,14 @@ public function listSubAccountTransfersWithHttpInfo($associative_array) /** * Operation listSubAccountTransfersAsync * - * Transfer records between main and sub accounts + * Retrieve transfer records between main and sub accounts * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -1344,14 +1608,14 @@ function ($response) { /** * Operation listSubAccountTransfersAsyncWithHttpInfo * - * Transfer records between main and sub accounts + * Retrieve transfer records between main and sub accounts * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -1401,10 +1665,10 @@ function ($exception) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * @param int $from Time range beginning, default to 7 days before current time (optional) * @param int $to Time range ending, default to current time (optional) - * @param int $limit Maximum number of records returned in one list (optional, default to 100) + * @param int $limit Maximum number of records to be returned in a single list (optional, default to 100) * @param int $offset List offset, starting from 0 (optional, default to 0) * * @throws \InvalidArgumentException @@ -1776,17 +2040,227 @@ protected function transferWithSubAccountRequest($sub_account_transfer) } /** - * Operation listWithdrawStatus - * - * Retrieve withdrawal status + * Operation subAccountToSubAccount * - * Note: the input parameter is an associative array with the keys listed as the parameter name below + * Sub-account transfers to sub-account * - * @param string $currency Retrieved specified currency related data (optional) + * @param \GateApi\Model\SubAccountToSubAccount $sub_account_to_sub_account sub_account_to_sub_account (required) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\WithdrawStatus[] + * @return void + */ + public function subAccountToSubAccount($sub_account_to_sub_account) + { + $this->subAccountToSubAccountWithHttpInfo($sub_account_to_sub_account); + } + + /** + * Operation subAccountToSubAccountWithHttpInfo + * + * Sub-account transfers to sub-account + * + * @param \GateApi\Model\SubAccountToSubAccount $sub_account_to_sub_account (required) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function subAccountToSubAccountWithHttpInfo($sub_account_to_sub_account) + { + $request = $this->subAccountToSubAccountRequest($sub_account_to_sub_account); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + return [null, $statusCode, $response->getHeaders()]; + } + + /** + * Operation subAccountToSubAccountAsync + * + * Sub-account transfers to sub-account + * + * @param \GateApi\Model\SubAccountToSubAccount $sub_account_to_sub_account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function subAccountToSubAccountAsync($sub_account_to_sub_account) + { + return $this->subAccountToSubAccountAsyncWithHttpInfo($sub_account_to_sub_account) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation subAccountToSubAccountAsyncWithHttpInfo + * + * Sub-account transfers to sub-account + * + * @param \GateApi\Model\SubAccountToSubAccount $sub_account_to_sub_account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function subAccountToSubAccountAsyncWithHttpInfo($sub_account_to_sub_account) + { + $returnType = ''; + $request = $this->subAccountToSubAccountRequest($sub_account_to_sub_account); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'subAccountToSubAccount' + * + * @param \GateApi\Model\SubAccountToSubAccount $sub_account_to_sub_account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function subAccountToSubAccountRequest($sub_account_to_sub_account) + { + // verify the required parameter 'sub_account_to_sub_account' is set + if ($sub_account_to_sub_account === null || (is_array($sub_account_to_sub_account) && count($sub_account_to_sub_account) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sub_account_to_sub_account when calling subAccountToSubAccount' + ); + } + + $resourcePath = '/wallet/sub_account_to_sub_account'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // body params + $_tempBody = null; + if (isset($sub_account_to_sub_account)) { + $_tempBody = $sub_account_to_sub_account; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('POST', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listWithdrawStatus + * + * Retrieve withdrawal status + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Retrieve data of the specified currency (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\WithdrawStatus[] */ public function listWithdrawStatus($associative_array) { @@ -1801,7 +2275,7 @@ public function listWithdrawStatus($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -1857,7 +2331,7 @@ public function listWithdrawStatusWithHttpInfo($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1879,7 +2353,7 @@ function ($response) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -1928,7 +2402,7 @@ function ($exception) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $currency Retrieved specified currency related data (optional) + * @param string $currency Retrieve data of the specified currency (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -2032,7 +2506,7 @@ protected function listWithdrawStatusRequest($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -2051,7 +2525,7 @@ public function listSubAccountBalances($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -2107,7 +2581,7 @@ public function listSubAccountBalancesWithHttpInfo($associative_array) * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2129,7 +2603,7 @@ function ($response) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -2178,7 +2652,7 @@ function ($exception) { * * Note: the input parameter is an associative array with the keys listed as the parameter name below * - * @param string $sub_uid Sub account user ID. Return records related to all sub accounts if not specified (optional) + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request @@ -2276,32 +2750,40 @@ protected function listSubAccountBalancesRequest($associative_array) } /** - * Operation getTradeFee + * Operation listSubAccountMarginBalances * - * Retrieve personal trading fee + * Query sub accounts' margin balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \GateApi\Model\TradeFee + * @return \GateApi\Model\SubAccountMarginBalance[] */ - public function getTradeFee() + public function listSubAccountMarginBalances($associative_array) { - list($response) = $this->getTradeFeeWithHttpInfo(); + list($response) = $this->listSubAccountMarginBalancesWithHttpInfo($associative_array); return $response; } /** - * Operation getTradeFeeWithHttpInfo + * Operation listSubAccountMarginBalancesWithHttpInfo * - * Retrieve personal trading fee + * Query sub accounts' margin balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \GateApi\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \GateApi\Model\TradeFee, HTTP status code, HTTP response headers (array of strings) + * @return array of \GateApi\Model\SubAccountMarginBalance[], HTTP status code, HTTP response headers (array of strings) */ - public function getTradeFeeWithHttpInfo() + public function listSubAccountMarginBalancesWithHttpInfo($associative_array) { - $request = $this->getTradeFeeRequest(); + $request = $this->listSubAccountMarginBalancesRequest($associative_array); $options = $this->createHttpClientOption(); try { @@ -2327,7 +2809,7 @@ public function getTradeFeeWithHttpInfo() ); } - $returnType = '\GateApi\Model\TradeFee'; + $returnType = '\GateApi\Model\SubAccountMarginBalance[]'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer @@ -2343,16 +2825,20 @@ public function getTradeFeeWithHttpInfo() } /** - * Operation getTradeFeeAsync + * Operation listSubAccountMarginBalancesAsync * - * Retrieve personal trading fee + * Query sub accounts' margin balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTradeFeeAsync() + public function listSubAccountMarginBalancesAsync($associative_array) { - return $this->getTradeFeeAsyncWithHttpInfo() + return $this->listSubAccountMarginBalancesAsyncWithHttpInfo($associative_array) ->then( function ($response) { return $response[0]; @@ -2361,17 +2847,21 @@ function ($response) { } /** - * Operation getTradeFeeAsyncWithHttpInfo + * Operation listSubAccountMarginBalancesAsyncWithHttpInfo * - * Retrieve personal trading fee + * Query sub accounts' margin balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTradeFeeAsyncWithHttpInfo() + public function listSubAccountMarginBalancesAsyncWithHttpInfo($associative_array) { - $returnType = '\GateApi\Model\TradeFee'; - $request = $this->getTradeFeeRequest(); + $returnType = '\GateApi\Model\SubAccountMarginBalance[]'; + $request = $this->listSubAccountMarginBalancesRequest($associative_array); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2408,21 +2898,1368 @@ function ($exception) { } /** - * Create request for operation 'getTradeFee' + * Create request for operation 'listSubAccountMarginBalances' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - protected function getTradeFeeRequest() + protected function listSubAccountMarginBalancesRequest($associative_array) { + // unbox the parameters from the associative array + $sub_uid = array_key_exists('sub_uid', $associative_array) ? $associative_array['sub_uid'] : null; - $resourcePath = '/wallet/fee'; + + $resourcePath = '/wallet/sub_account_margin_balances'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + if ($sub_uid !== null) { + if('form' === 'form' && is_array($sub_uid)) { + foreach($sub_uid as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['sub_uid'] = $sub_uid; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listSubAccountFuturesBalances + * + * Query sub accounts' futures account balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * @param string $settle Query only balances of specified settle currency (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccountFuturesBalance[] + */ + public function listSubAccountFuturesBalances($associative_array) + { + list($response) = $this->listSubAccountFuturesBalancesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listSubAccountFuturesBalancesWithHttpInfo + * + * Query sub accounts' futures account balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * @param string $settle Query only balances of specified settle currency (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccountFuturesBalance[], HTTP status code, HTTP response headers (array of strings) + */ + public function listSubAccountFuturesBalancesWithHttpInfo($associative_array) + { + $request = $this->listSubAccountFuturesBalancesRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccountFuturesBalance[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listSubAccountFuturesBalancesAsync + * + * Query sub accounts' futures account balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * @param string $settle Query only balances of specified settle currency (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountFuturesBalancesAsync($associative_array) + { + return $this->listSubAccountFuturesBalancesAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listSubAccountFuturesBalancesAsyncWithHttpInfo + * + * Query sub accounts' futures account balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * @param string $settle Query only balances of specified settle currency (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountFuturesBalancesAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\SubAccountFuturesBalance[]'; + $request = $this->listSubAccountFuturesBalancesRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listSubAccountFuturesBalances' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * @param string $settle Query only balances of specified settle currency (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listSubAccountFuturesBalancesRequest($associative_array) + { + // unbox the parameters from the associative array + $sub_uid = array_key_exists('sub_uid', $associative_array) ? $associative_array['sub_uid'] : null; + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + + + $resourcePath = '/wallet/sub_account_futures_balances'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($sub_uid !== null) { + if('form' === 'form' && is_array($sub_uid)) { + foreach($sub_uid as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['sub_uid'] = $sub_uid; + } + } + + // query params + if ($settle !== null) { + if('form' === 'form' && is_array($settle)) { + foreach($settle as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['settle'] = $settle; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listSubAccountCrossMarginBalances + * + * Query subaccount's cross_margin account info + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SubAccountCrossMarginBalance[] + */ + public function listSubAccountCrossMarginBalances($associative_array) + { + list($response) = $this->listSubAccountCrossMarginBalancesWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listSubAccountCrossMarginBalancesWithHttpInfo + * + * Query subaccount's cross_margin account info + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SubAccountCrossMarginBalance[], HTTP status code, HTTP response headers (array of strings) + */ + public function listSubAccountCrossMarginBalancesWithHttpInfo($associative_array) + { + $request = $this->listSubAccountCrossMarginBalancesRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SubAccountCrossMarginBalance[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listSubAccountCrossMarginBalancesAsync + * + * Query subaccount's cross_margin account info + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountCrossMarginBalancesAsync($associative_array) + { + return $this->listSubAccountCrossMarginBalancesAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listSubAccountCrossMarginBalancesAsyncWithHttpInfo + * + * Query subaccount's cross_margin account info + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSubAccountCrossMarginBalancesAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\SubAccountCrossMarginBalance[]'; + $request = $this->listSubAccountCrossMarginBalancesRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listSubAccountCrossMarginBalances' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $sub_uid User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listSubAccountCrossMarginBalancesRequest($associative_array) + { + // unbox the parameters from the associative array + $sub_uid = array_key_exists('sub_uid', $associative_array) ? $associative_array['sub_uid'] : null; + + + $resourcePath = '/wallet/sub_account_cross_margin_balances'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($sub_uid !== null) { + if('form' === 'form' && is_array($sub_uid)) { + foreach($sub_uid as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['sub_uid'] = $sub_uid; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listSavedAddress + * + * Query saved address + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency (required) + * @param string $chain Chain name (optional, default to '') + * @param string $limit Maximum number returned, 100 at most (optional, default to '50') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\SavedAddress[] + */ + public function listSavedAddress($associative_array) + { + list($response) = $this->listSavedAddressWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation listSavedAddressWithHttpInfo + * + * Query saved address + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency (required) + * @param string $chain Chain name (optional, default to '') + * @param string $limit Maximum number returned, 100 at most (optional, default to '50') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\SavedAddress[], HTTP status code, HTTP response headers (array of strings) + */ + public function listSavedAddressWithHttpInfo($associative_array) + { + $request = $this->listSavedAddressRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\SavedAddress[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation listSavedAddressAsync + * + * Query saved address + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency (required) + * @param string $chain Chain name (optional, default to '') + * @param string $limit Maximum number returned, 100 at most (optional, default to '50') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSavedAddressAsync($associative_array) + { + return $this->listSavedAddressAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listSavedAddressAsyncWithHttpInfo + * + * Query saved address + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency (required) + * @param string $chain Chain name (optional, default to '') + * @param string $limit Maximum number returned, 100 at most (optional, default to '50') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSavedAddressAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\SavedAddress[]'; + $request = $this->listSavedAddressRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listSavedAddress' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency (required) + * @param string $chain Chain name (optional, default to '') + * @param string $limit Maximum number returned, 100 at most (optional, default to '50') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function listSavedAddressRequest($associative_array) + { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : null; + $chain = array_key_exists('chain', $associative_array) ? $associative_array['chain'] : ''; + $limit = array_key_exists('limit', $associative_array) ? $associative_array['limit'] : '50'; + + // verify the required parameter 'currency' is set + if ($currency === null || (is_array($currency) && count($currency) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $currency when calling listSavedAddress' + ); + } + + $resourcePath = '/wallet/saved_address'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + + // query params + if ($chain !== null) { + if('form' === 'form' && is_array($chain)) { + foreach($chain as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['chain'] = $chain; + } + } + + // query params + if ($limit !== null) { + if('form' === 'form' && is_array($limit)) { + foreach($limit as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['limit'] = $limit; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTradeFee + * + * Retrieve personal trading fee + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional) + * @param string $settle Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\TradeFee + */ + public function getTradeFee($associative_array) + { + list($response) = $this->getTradeFeeWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation getTradeFeeWithHttpInfo + * + * Retrieve personal trading fee + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional) + * @param string $settle Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. (optional) + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\TradeFee, HTTP status code, HTTP response headers (array of strings) + */ + public function getTradeFeeWithHttpInfo($associative_array) + { + $request = $this->getTradeFeeRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\TradeFee'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getTradeFeeAsync + * + * Retrieve personal trading fee + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional) + * @param string $settle Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTradeFeeAsync($associative_array) + { + return $this->getTradeFeeAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTradeFeeAsyncWithHttpInfo + * + * Retrieve personal trading fee + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional) + * @param string $settle Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTradeFeeAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\TradeFee'; + $request = $this->getTradeFeeRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTradeFee' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency_pair Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional) + * @param string $settle Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getTradeFeeRequest($associative_array) + { + // unbox the parameters from the associative array + $currency_pair = array_key_exists('currency_pair', $associative_array) ? $associative_array['currency_pair'] : null; + $settle = array_key_exists('settle', $associative_array) ? $associative_array['settle'] : null; + + + $resourcePath = '/wallet/fee'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency_pair !== null) { + if('form' === 'form' && is_array($currency_pair)) { + foreach($currency_pair as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency_pair'] = $currency_pair; + } + } + + // query params + if ($settle !== null) { + if('form' === 'form' && is_array($settle)) { + foreach($settle as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['settle'] = $settle; + } + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires Gate APIv4 authentication + $signHeaders = $this->config->buildSignHeaders('GET', $resourcePath, $queryParams, $httpBody); + $headers = array_merge($headers, $signHeaders); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getTotalBalance + * + * Retrieve user's total balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. (optional, default to 'USDT') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \GateApi\Model\TotalBalance + */ + public function getTotalBalance($associative_array) + { + list($response) = $this->getTotalBalanceWithHttpInfo($associative_array); + return $response; + } + + /** + * Operation getTotalBalanceWithHttpInfo + * + * Retrieve user's total balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. (optional, default to 'USDT') + * + * @throws \GateApi\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \GateApi\Model\TotalBalance, HTTP status code, HTTP response headers (array of strings) + */ + public function getTotalBalanceWithHttpInfo($associative_array) + { + $request = $this->getTotalBalanceRequest($associative_array); + + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + $responseBody = $e->getResponse() ? (string) $e->getResponse()->getBody() : null; + if ($responseBody !== null) { + $gateError = json_decode($responseBody, true); + if ($gateError !== null && isset($gateError['label'])) { + throw new GateApiException( + $gateError, + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + } + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $responseBody + ); + } + + $returnType = '\GateApi\Model\TotalBalance'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + /** + * Operation getTotalBalanceAsync + * + * Retrieve user's total balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. (optional, default to 'USDT') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTotalBalanceAsync($associative_array) + { + return $this->getTotalBalanceAsyncWithHttpInfo($associative_array) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTotalBalanceAsyncWithHttpInfo + * + * Retrieve user's total balances + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. (optional, default to 'USDT') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTotalBalanceAsyncWithHttpInfo($associative_array) + { + $returnType = '\GateApi\Model\TotalBalance'; + $request = $this->getTotalBalanceRequest($associative_array); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTotalBalance' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $currency Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. (optional, default to 'USDT') + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getTotalBalanceRequest($associative_array) + { + // unbox the parameters from the associative array + $currency = array_key_exists('currency', $associative_array) ? $associative_array['currency'] : 'USDT'; + + + $resourcePath = '/wallet/total_balance'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($currency !== null) { + if('form' === 'form' && is_array($currency)) { + foreach($currency as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['currency'] = $currency; + } + } + // body params $_tempBody = null; diff --git a/src/Configuration.php b/src/Configuration.php index d5a0931..d79cc16 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -71,7 +71,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/5.21.2/PHP'; + protected $userAgent = 'OpenAPI-Generator/5.40.0/PHP'; /** * Debug switch (default set to false) @@ -387,18 +387,18 @@ public static function toDebugReport() $report = 'PHP SDK (GateApi) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: 4.21.2' . PHP_EOL; - $report .= ' SDK Package Version: 5.21.2' . PHP_EOL; + $report .= ' The version of the OpenAPI document: 4.40.0' . PHP_EOL; + $report .= ' SDK Package Version: 5.40.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; } /** - * @param string $method Request method - * @param string $resourcePath Request path - * @param array $queryParams Query parameter array - * @param string $payload Body string + * @param string $method Request method + * @param string $resourcePath Request path + * @param array $queryParams Query parameter array + * @param string $payload Body string * @return array Signature headers */ public function buildSignHeaders($method, $resourcePath, $queryParams = null, $payload = null) diff --git a/src/HeaderSelector.php b/src/HeaderSelector.php index 938a1c9..ac37136 100644 --- a/src/HeaderSelector.php +++ b/src/HeaderSelector.php @@ -39,8 +39,8 @@ class HeaderSelector { /** - * @param string[] $accept - * @param string[] $contentTypes + * @param string[] $accept + * @param string[] $contentTypes * @return array */ public function selectHeaders($accept, $contentTypes) @@ -57,7 +57,7 @@ public function selectHeaders($accept, $contentTypes) } /** - * @param string[] $accept + * @param string[] $accept * @return array */ public function selectHeadersForMultipart($accept) diff --git a/src/Model/AccountBalance.php b/src/Model/AccountBalance.php new file mode 100644 index 0000000..314f1c0 --- /dev/null +++ b/src/Model/AccountBalance.php @@ -0,0 +1,372 @@ + 'string', + 'currency' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'currency' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'currency' => 'currency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'currency' => 'setCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'currency' => 'getCurrency' + ]; + + /** + * 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::$openAPIModelName; + } + + const CURRENCY_BTC = 'BTC'; + const CURRENCY_CNY = 'CNY'; + const CURRENCY_USD = 'USD'; + const CURRENCY_USDT = 'USDT'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCurrencyAllowableValues() + { + return [ + self::CURRENCY_BTC, + self::CURRENCY_CNY, + self::CURRENCY_USD, + self::CURRENCY_USDT, + ]; + } + + + /** + * 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['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getCurrencyAllowableValues(); + if (!is_null($this->container['currency']) && !in_array($this->container['currency'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'currency', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Account total balance amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency + * + * @return $this + */ + public function setCurrency($currency) + { + $allowedValues = $this->getCurrencyAllowableValues(); + if (!is_null($currency) && !in_array($currency, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'currency', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['currency'] = $currency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AgencyCommission.php b/src/Model/AgencyCommission.php new file mode 100644 index 0000000..0fd9190 --- /dev/null +++ b/src/Model/AgencyCommission.php @@ -0,0 +1,455 @@ + 'int', + 'user_id' => 'int', + 'group_name' => 'string', + 'commission_amount' => 'string', + 'commission_asset' => 'string', + 'source' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'commission_time' => 'int64', + 'user_id' => 'int64', + 'group_name' => null, + 'commission_amount' => null, + 'commission_asset' => null, + 'source' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'commission_time' => 'commission_time', + 'user_id' => 'user_id', + 'group_name' => 'group_name', + 'commission_amount' => 'commission_amount', + 'commission_asset' => 'commission_asset', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'commission_time' => 'setCommissionTime', + 'user_id' => 'setUserId', + 'group_name' => 'setGroupName', + 'commission_amount' => 'setCommissionAmount', + 'commission_asset' => 'setCommissionAsset', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'commission_time' => 'getCommissionTime', + 'user_id' => 'getUserId', + 'group_name' => 'getGroupName', + 'commission_amount' => 'getCommissionAmount', + 'commission_asset' => 'getCommissionAsset', + 'source' => 'getSource' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['commission_time'] = isset($data['commission_time']) ? $data['commission_time'] : null; + $this->container['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['group_name'] = isset($data['group_name']) ? $data['group_name'] : null; + $this->container['commission_amount'] = isset($data['commission_amount']) ? $data['commission_amount'] : null; + $this->container['commission_asset'] = isset($data['commission_asset']) ? $data['commission_asset'] : null; + $this->container['source'] = isset($data['source']) ? $data['source'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 commission_time + * + * @return int|null + */ + public function getCommissionTime() + { + return $this->container['commission_time']; + } + + /** + * Sets commission_time + * + * @param int|null $commission_time Commission Time. (unix timestamp) + * + * @return $this + */ + public function setCommissionTime($commission_time) + { + $this->container['commission_time'] = $commission_time; + + return $this; + } + + /** + * Gets user_id + * + * @return int|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param int|null $user_id User ID + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets group_name + * + * @return string|null + */ + public function getGroupName() + { + return $this->container['group_name']; + } + + /** + * Sets group_name + * + * @param string|null $group_name Group name + * + * @return $this + */ + public function setGroupName($group_name) + { + $this->container['group_name'] = $group_name; + + return $this; + } + + /** + * Gets commission_amount + * + * @return string|null + */ + public function getCommissionAmount() + { + return $this->container['commission_amount']; + } + + /** + * Sets commission_amount + * + * @param string|null $commission_amount Commission Amount + * + * @return $this + */ + public function setCommissionAmount($commission_amount) + { + $this->container['commission_amount'] = $commission_amount; + + return $this; + } + + /** + * Gets commission_asset + * + * @return string|null + */ + public function getCommissionAsset() + { + return $this->container['commission_asset']; + } + + /** + * Sets commission_asset + * + * @param string|null $commission_asset Commission Asset + * + * @return $this + */ + public function setCommissionAsset($commission_asset) + { + $this->container['commission_asset'] = $commission_asset; + + return $this; + } + + /** + * Gets source + * + * @return string|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string|null $source Source. SPOT - SPOT Rebate, FUTURES - Futures Rebate + * + * @return $this + */ + public function setSource($source) + { + $this->container['source'] = $source; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AgencyCommissionHistory.php b/src/Model/AgencyCommissionHistory.php new file mode 100644 index 0000000..7f2d22e --- /dev/null +++ b/src/Model/AgencyCommissionHistory.php @@ -0,0 +1,365 @@ + 'string', + 'total' => 'int', + 'list' => '\GateApi\Model\AgencyCommission[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency_pair' => null, + 'total' => 'int64', + 'list' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency_pair' => 'currency_pair', + 'total' => 'total', + 'list' => 'list' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency_pair' => 'setCurrencyPair', + 'total' => 'setTotal', + 'list' => 'setList' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency_pair' => 'getCurrencyPair', + 'total' => 'getTotal', + 'list' => 'getList' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['total'] = isset($data['total']) ? $data['total'] : null; + $this->container['list'] = isset($data['list']) ? $data['list'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total + * + * @return $this + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets list + * + * @return \GateApi\Model\AgencyCommission[]|null + */ + public function getList() + { + return $this->container['list']; + } + + /** + * Sets list + * + * @param \GateApi\Model\AgencyCommission[]|null $list List of comission history + * + * @return $this + */ + public function setList($list) + { + $this->container['list'] = $list; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AgencyTransaction.php b/src/Model/AgencyTransaction.php new file mode 100644 index 0000000..1444169 --- /dev/null +++ b/src/Model/AgencyTransaction.php @@ -0,0 +1,545 @@ + 'int', + 'user_id' => 'int', + 'group_name' => 'string', + 'fee' => 'string', + 'fee_asset' => 'string', + 'currency_pair' => 'string', + 'amount' => 'string', + 'amount_asset' => 'string', + 'source' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'transaction_time' => 'int64', + 'user_id' => 'int64', + 'group_name' => null, + 'fee' => null, + 'fee_asset' => null, + 'currency_pair' => null, + 'amount' => null, + 'amount_asset' => null, + 'source' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'transaction_time' => 'transaction_time', + 'user_id' => 'user_id', + 'group_name' => 'group_name', + 'fee' => 'fee', + 'fee_asset' => 'fee_asset', + 'currency_pair' => 'currency_pair', + 'amount' => 'amount', + 'amount_asset' => 'amount_asset', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transaction_time' => 'setTransactionTime', + 'user_id' => 'setUserId', + 'group_name' => 'setGroupName', + 'fee' => 'setFee', + 'fee_asset' => 'setFeeAsset', + 'currency_pair' => 'setCurrencyPair', + 'amount' => 'setAmount', + 'amount_asset' => 'setAmountAsset', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transaction_time' => 'getTransactionTime', + 'user_id' => 'getUserId', + 'group_name' => 'getGroupName', + 'fee' => 'getFee', + 'fee_asset' => 'getFeeAsset', + 'currency_pair' => 'getCurrencyPair', + 'amount' => 'getAmount', + 'amount_asset' => 'getAmountAsset', + 'source' => 'getSource' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['transaction_time'] = isset($data['transaction_time']) ? $data['transaction_time'] : null; + $this->container['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['group_name'] = isset($data['group_name']) ? $data['group_name'] : null; + $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; + $this->container['fee_asset'] = isset($data['fee_asset']) ? $data['fee_asset'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->container['amount_asset'] = isset($data['amount_asset']) ? $data['amount_asset'] : null; + $this->container['source'] = isset($data['source']) ? $data['source'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 transaction_time + * + * @return int|null + */ + public function getTransactionTime() + { + return $this->container['transaction_time']; + } + + /** + * Sets transaction_time + * + * @param int|null $transaction_time Transaction Time. (unix timestamp) + * + * @return $this + */ + public function setTransactionTime($transaction_time) + { + $this->container['transaction_time'] = $transaction_time; + + return $this; + } + + /** + * Gets user_id + * + * @return int|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param int|null $user_id User ID + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets group_name + * + * @return string|null + */ + public function getGroupName() + { + return $this->container['group_name']; + } + + /** + * Sets group_name + * + * @param string|null $group_name Group name + * + * @return $this + */ + public function setGroupName($group_name) + { + $this->container['group_name'] = $group_name; + + return $this; + } + + /** + * Gets fee + * + * @return string|null + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param string|null $fee Fee + * + * @return $this + */ + public function setFee($fee) + { + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets fee_asset + * + * @return string|null + */ + public function getFeeAsset() + { + return $this->container['fee_asset']; + } + + /** + * Sets fee_asset + * + * @param string|null $fee_asset Fee currency + * + * @return $this + */ + public function setFeeAsset($fee_asset) + { + $this->container['fee_asset'] = $fee_asset; + + return $this; + } + + /** + * Gets currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + + /** + * Gets amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Commission Amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets amount_asset + * + * @return string|null + */ + public function getAmountAsset() + { + return $this->container['amount_asset']; + } + + /** + * Sets amount_asset + * + * @param string|null $amount_asset Commission Asset + * + * @return $this + */ + public function setAmountAsset($amount_asset) + { + $this->container['amount_asset'] = $amount_asset; + + return $this; + } + + /** + * Gets source + * + * @return string|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string|null $source Source. SPOT - SPOT Rebate, FUTURES - Futures Rebate + * + * @return $this + */ + public function setSource($source) + { + $this->container['source'] = $source; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AgencyTransactionHistory.php b/src/Model/AgencyTransactionHistory.php new file mode 100644 index 0000000..0956b56 --- /dev/null +++ b/src/Model/AgencyTransactionHistory.php @@ -0,0 +1,365 @@ + 'string', + 'total' => 'int', + 'list' => '\GateApi\Model\AgencyTransaction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency_pair' => null, + 'total' => 'int64', + 'list' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency_pair' => 'currency_pair', + 'total' => 'total', + 'list' => 'list' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency_pair' => 'setCurrencyPair', + 'total' => 'setTotal', + 'list' => 'setList' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency_pair' => 'getCurrencyPair', + 'total' => 'getTotal', + 'list' => 'getList' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['total'] = isset($data['total']) ? $data['total'] : null; + $this->container['list'] = isset($data['list']) ? $data['list'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total + * + * @return $this + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets list + * + * @return \GateApi\Model\AgencyTransaction[]|null + */ + public function getList() + { + return $this->container['list']; + } + + /** + * Sets list + * + * @param \GateApi\Model\AgencyTransaction[]|null $list List of transaction history + * + * @return $this + */ + public function setList($list) + { + $this->container['list'] = $list; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ApiV4KeyPerm.php b/src/Model/ApiV4KeyPerm.php new file mode 100644 index 0000000..450fcf5 --- /dev/null +++ b/src/Model/ApiV4KeyPerm.php @@ -0,0 +1,375 @@ + 'string', + 'read_only' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'read_only' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'read_only' => 'read_only' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'read_only' => 'setReadOnly' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'read_only' => 'getReadOnly' + ]; + + /** + * 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::$openAPIModelName; + } + + const NAME_WALLET = 'wallet'; + const NAME_SPOT = 'spot'; + const NAME_FUTURES = 'futures'; + const NAME_DELIVERY = 'delivery'; + const NAME_EARN = 'earn'; + const NAME_OPTIONS = 'options'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNameAllowableValues() + { + return [ + self::NAME_WALLET, + self::NAME_SPOT, + self::NAME_FUTURES, + self::NAME_DELIVERY, + self::NAME_EARN, + self::NAME_OPTIONS, + ]; + } + + + /** + * 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['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['read_only'] = isset($data['read_only']) ? $data['read_only'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($this->container['name']) && !in_array($this->container['name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'name', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Permission name (all permissions will be removed if no value is passed) - wallet: wallet - spot: spot/margin - futures: perpetual contract - delivery: delivery - earn: earn - options: options + * + * @return $this + */ + public function setName($name) + { + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($name) && !in_array($name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'name', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets read_only + * + * @return bool|null + */ + public function getReadOnly() + { + return $this->container['read_only']; + } + + /** + * Sets read_only + * + * @param bool|null $read_only read only + * + * @return $this + */ + public function setReadOnly($read_only) + { + $this->container['read_only'] = $read_only; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AutoRepaySetting.php b/src/Model/AutoRepaySetting.php index 198e38f..284911e 100644 --- a/src/Model/AutoRepaySetting.php +++ b/src/Model/AutoRepaySetting.php @@ -42,26 +42,26 @@ class AutoRepaySetting implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'AutoRepaySetting'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'status' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'status' => null ]; @@ -263,7 +263,7 @@ public function setStatus($status) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -275,9 +275,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -288,7 +289,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -304,7 +305,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/BatchFuturesOrder.php b/src/Model/BatchFuturesOrder.php new file mode 100644 index 0000000..100e380 --- /dev/null +++ b/src/Model/BatchFuturesOrder.php @@ -0,0 +1,1200 @@ + 'bool', + 'label' => 'string', + 'detail' => 'string', + 'id' => 'int', + 'user' => 'int', + 'create_time' => 'double', + 'finish_time' => 'double', + 'finish_as' => 'string', + 'status' => 'string', + 'contract' => 'string', + 'size' => 'int', + 'iceberg' => 'int', + 'price' => 'string', + 'close' => 'bool', + 'is_close' => 'bool', + 'reduce_only' => 'bool', + 'is_reduce_only' => 'bool', + 'is_liq' => 'bool', + 'tif' => 'string', + 'left' => 'int', + 'fill_price' => 'string', + 'text' => 'string', + 'tkfr' => 'string', + 'mkfr' => 'string', + 'refu' => 'int', + 'auto_size' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'succeeded' => null, + 'label' => null, + 'detail' => null, + 'id' => 'int64', + 'user' => null, + 'create_time' => 'double', + 'finish_time' => 'double', + 'finish_as' => null, + 'status' => null, + 'contract' => null, + 'size' => 'int64', + 'iceberg' => 'int64', + 'price' => null, + 'close' => null, + 'is_close' => null, + 'reduce_only' => null, + 'is_reduce_only' => null, + 'is_liq' => null, + 'tif' => null, + 'left' => 'int64', + 'fill_price' => null, + 'text' => null, + 'tkfr' => null, + 'mkfr' => null, + 'refu' => null, + 'auto_size' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'succeeded' => 'succeeded', + 'label' => 'label', + 'detail' => 'detail', + 'id' => 'id', + 'user' => 'user', + 'create_time' => 'create_time', + 'finish_time' => 'finish_time', + 'finish_as' => 'finish_as', + 'status' => 'status', + 'contract' => 'contract', + 'size' => 'size', + 'iceberg' => 'iceberg', + 'price' => 'price', + 'close' => 'close', + 'is_close' => 'is_close', + 'reduce_only' => 'reduce_only', + 'is_reduce_only' => 'is_reduce_only', + 'is_liq' => 'is_liq', + 'tif' => 'tif', + 'left' => 'left', + 'fill_price' => 'fill_price', + 'text' => 'text', + 'tkfr' => 'tkfr', + 'mkfr' => 'mkfr', + 'refu' => 'refu', + 'auto_size' => 'auto_size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'succeeded' => 'setSucceeded', + 'label' => 'setLabel', + 'detail' => 'setDetail', + 'id' => 'setId', + 'user' => 'setUser', + 'create_time' => 'setCreateTime', + 'finish_time' => 'setFinishTime', + 'finish_as' => 'setFinishAs', + 'status' => 'setStatus', + 'contract' => 'setContract', + 'size' => 'setSize', + 'iceberg' => 'setIceberg', + 'price' => 'setPrice', + 'close' => 'setClose', + 'is_close' => 'setIsClose', + 'reduce_only' => 'setReduceOnly', + 'is_reduce_only' => 'setIsReduceOnly', + 'is_liq' => 'setIsLiq', + 'tif' => 'setTif', + 'left' => 'setLeft', + 'fill_price' => 'setFillPrice', + 'text' => 'setText', + 'tkfr' => 'setTkfr', + 'mkfr' => 'setMkfr', + 'refu' => 'setRefu', + 'auto_size' => 'setAutoSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'succeeded' => 'getSucceeded', + 'label' => 'getLabel', + 'detail' => 'getDetail', + 'id' => 'getId', + 'user' => 'getUser', + 'create_time' => 'getCreateTime', + 'finish_time' => 'getFinishTime', + 'finish_as' => 'getFinishAs', + 'status' => 'getStatus', + 'contract' => 'getContract', + 'size' => 'getSize', + 'iceberg' => 'getIceberg', + 'price' => 'getPrice', + 'close' => 'getClose', + 'is_close' => 'getIsClose', + 'reduce_only' => 'getReduceOnly', + 'is_reduce_only' => 'getIsReduceOnly', + 'is_liq' => 'getIsLiq', + 'tif' => 'getTif', + 'left' => 'getLeft', + 'fill_price' => 'getFillPrice', + 'text' => 'getText', + 'tkfr' => 'getTkfr', + 'mkfr' => 'getMkfr', + 'refu' => 'getRefu', + 'auto_size' => 'getAutoSize' + ]; + + /** + * 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::$openAPIModelName; + } + + const FINISH_AS_FILLED = 'filled'; + const FINISH_AS_CANCELLED = 'cancelled'; + const FINISH_AS_LIQUIDATED = 'liquidated'; + const FINISH_AS_IOC = 'ioc'; + const FINISH_AS_AUTO_DELEVERAGED = 'auto_deleveraged'; + const FINISH_AS_REDUCE_ONLY = 'reduce_only'; + const FINISH_AS_POSITION_CLOSED = 'position_closed'; + const FINISH_AS_REDUCE_OUT = 'reduce_out'; + const STATUS_OPEN = 'open'; + const STATUS_FINISHED = 'finished'; + const TIF_GTC = 'gtc'; + const TIF_IOC = 'ioc'; + const TIF_POC = 'poc'; + const TIF_FOK = 'fok'; + const AUTO_SIZE_LONG = 'close_long'; + const AUTO_SIZE_SHORT = 'close_short'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFinishAsAllowableValues() + { + return [ + self::FINISH_AS_FILLED, + self::FINISH_AS_CANCELLED, + self::FINISH_AS_LIQUIDATED, + self::FINISH_AS_IOC, + self::FINISH_AS_AUTO_DELEVERAGED, + self::FINISH_AS_REDUCE_ONLY, + self::FINISH_AS_POSITION_CLOSED, + self::FINISH_AS_REDUCE_OUT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_OPEN, + self::STATUS_FINISHED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTifAllowableValues() + { + return [ + self::TIF_GTC, + self::TIF_IOC, + self::TIF_POC, + self::TIF_FOK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAutoSizeAllowableValues() + { + return [ + self::AUTO_SIZE_LONG, + self::AUTO_SIZE_SHORT, + ]; + } + + + /** + * 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['succeeded'] = isset($data['succeeded']) ? $data['succeeded'] : null; + $this->container['label'] = isset($data['label']) ? $data['label'] : null; + $this->container['detail'] = isset($data['detail']) ? $data['detail'] : null; + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['user'] = isset($data['user']) ? $data['user'] : null; + $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; + $this->container['finish_time'] = isset($data['finish_time']) ? $data['finish_time'] : null; + $this->container['finish_as'] = isset($data['finish_as']) ? $data['finish_as'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['size'] = isset($data['size']) ? $data['size'] : null; + $this->container['iceberg'] = isset($data['iceberg']) ? $data['iceberg'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['close'] = isset($data['close']) ? $data['close'] : false; + $this->container['is_close'] = isset($data['is_close']) ? $data['is_close'] : null; + $this->container['reduce_only'] = isset($data['reduce_only']) ? $data['reduce_only'] : false; + $this->container['is_reduce_only'] = isset($data['is_reduce_only']) ? $data['is_reduce_only'] : null; + $this->container['is_liq'] = isset($data['is_liq']) ? $data['is_liq'] : null; + $this->container['tif'] = isset($data['tif']) ? $data['tif'] : 'gtc'; + $this->container['left'] = isset($data['left']) ? $data['left'] : null; + $this->container['fill_price'] = isset($data['fill_price']) ? $data['fill_price'] : null; + $this->container['text'] = isset($data['text']) ? $data['text'] : null; + $this->container['tkfr'] = isset($data['tkfr']) ? $data['tkfr'] : null; + $this->container['mkfr'] = isset($data['mkfr']) ? $data['mkfr'] : null; + $this->container['refu'] = isset($data['refu']) ? $data['refu'] : null; + $this->container['auto_size'] = isset($data['auto_size']) ? $data['auto_size'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getFinishAsAllowableValues(); + if (!is_null($this->container['finish_as']) && !in_array($this->container['finish_as'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'finish_as', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'status', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTifAllowableValues(); + if (!is_null($this->container['tif']) && !in_array($this->container['tif'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'tif', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAutoSizeAllowableValues(); + if (!is_null($this->container['auto_size']) && !in_array($this->container['auto_size'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'auto_size', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 succeeded + * + * @return bool|null + */ + public function getSucceeded() + { + return $this->container['succeeded']; + } + + /** + * Sets succeeded + * + * @param bool|null $succeeded Whether the batch of orders succeeded + * + * @return $this + */ + public function setSucceeded($succeeded) + { + $this->container['succeeded'] = $succeeded; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label Error label, only exists if execution fails + * + * @return $this + */ + public function setLabel($label) + { + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets detail + * + * @return string|null + */ + public function getDetail() + { + return $this->container['detail']; + } + + /** + * Sets detail + * + * @param string|null $detail Error detail, only present if execution failed and details need to be given + * + * @return $this + */ + public function setDetail($detail) + { + $this->container['detail'] = $detail; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Futures order ID + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user + * + * @return int|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param int|null $user User ID + * + * @return $this + */ + public function setUser($user) + { + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets create_time + * + * @return double|null + */ + public function getCreateTime() + { + return $this->container['create_time']; + } + + /** + * Sets create_time + * + * @param double|null $create_time Creation time of order + * + * @return $this + */ + public function setCreateTime($create_time) + { + $this->container['create_time'] = $create_time; + + return $this; + } + + /** + * Gets finish_time + * + * @return double|null + */ + public function getFinishTime() + { + return $this->container['finish_time']; + } + + /** + * Sets finish_time + * + * @param double|null $finish_time Order finished time. Not returned if order is open + * + * @return $this + */ + public function setFinishTime($finish_time) + { + $this->container['finish_time'] = $finish_time; + + return $this; + } + + /** + * Gets finish_as + * + * @return string|null + */ + public function getFinishAs() + { + return $this->container['finish_as']; + } + + /** + * Sets finish_as + * + * @param string|null $finish_as How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close + * + * @return $this + */ + public function setFinishAs($finish_as) + { + $allowedValues = $this->getFinishAsAllowableValues(); + if (!is_null($finish_as) && !in_array($finish_as, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'finish_as', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['finish_as'] = $finish_as; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Order status - `open`: waiting to be traded - `finished`: finished + * + * @return $this + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'status', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Futures contract + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size Order size. Specify positive number to make a bid, and negative number to ask + * + * @return $this + */ + public function setSize($size) + { + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets iceberg + * + * @return int|null + */ + public function getIceberg() + { + return $this->container['iceberg']; + } + + /** + * Sets iceberg + * + * @param int|null $iceberg Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size + * + * @return $this + */ + public function setIceberg($iceberg) + { + $this->container['iceberg'] = $iceberg; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Order price. 0 for market order with `tif` set as `ioc` + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets close + * + * @return bool|null + */ + public function getClose() + { + return $this->container['close']; + } + + /** + * Sets close + * + * @param bool|null $close Set as `true` to close the position, with `size` set to 0 + * + * @return $this + */ + public function setClose($close) + { + $this->container['close'] = $close; + + return $this; + } + + /** + * Gets is_close + * + * @return bool|null + */ + public function getIsClose() + { + return $this->container['is_close']; + } + + /** + * Sets is_close + * + * @param bool|null $is_close Is the order to close position + * + * @return $this + */ + public function setIsClose($is_close) + { + $this->container['is_close'] = $is_close; + + return $this; + } + + /** + * Gets reduce_only + * + * @return bool|null + */ + public function getReduceOnly() + { + return $this->container['reduce_only']; + } + + /** + * Sets reduce_only + * + * @param bool|null $reduce_only Set as `true` to be reduce-only order + * + * @return $this + */ + public function setReduceOnly($reduce_only) + { + $this->container['reduce_only'] = $reduce_only; + + return $this; + } + + /** + * Gets is_reduce_only + * + * @return bool|null + */ + public function getIsReduceOnly() + { + return $this->container['is_reduce_only']; + } + + /** + * Sets is_reduce_only + * + * @param bool|null $is_reduce_only Is the order reduce-only + * + * @return $this + */ + public function setIsReduceOnly($is_reduce_only) + { + $this->container['is_reduce_only'] = $is_reduce_only; + + return $this; + } + + /** + * Gets is_liq + * + * @return bool|null + */ + public function getIsLiq() + { + return $this->container['is_liq']; + } + + /** + * Sets is_liq + * + * @param bool|null $is_liq Is the order for liquidation + * + * @return $this + */ + public function setIsLiq($is_liq) + { + $this->container['is_liq'] = $is_liq; + + return $this; + } + + /** + * Gets tif + * + * @return string|null + */ + public function getTif() + { + return $this->container['tif']; + } + + /** + * Sets tif + * + * @param string|null $tif Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none + * + * @return $this + */ + public function setTif($tif) + { + $allowedValues = $this->getTifAllowableValues(); + if (!is_null($tif) && !in_array($tif, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'tif', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['tif'] = $tif; + + return $this; + } + + /** + * Gets left + * + * @return int|null + */ + public function getLeft() + { + return $this->container['left']; + } + + /** + * Sets left + * + * @param int|null $left Size left to be traded + * + * @return $this + */ + public function setLeft($left) + { + $this->container['left'] = $left; + + return $this; + } + + /** + * Gets fill_price + * + * @return string|null + */ + public function getFillPrice() + { + return $this->container['fill_price']; + } + + /** + * Sets fill_price + * + * @param string|null $fill_price Fill price of the order + * + * @return $this + */ + public function setFillPrice($fill_price) + { + $this->container['fill_price'] = $fill_price; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets tkfr + * + * @return string|null + */ + public function getTkfr() + { + return $this->container['tkfr']; + } + + /** + * Sets tkfr + * + * @param string|null $tkfr Taker fee + * + * @return $this + */ + public function setTkfr($tkfr) + { + $this->container['tkfr'] = $tkfr; + + return $this; + } + + /** + * Gets mkfr + * + * @return string|null + */ + public function getMkfr() + { + return $this->container['mkfr']; + } + + /** + * Sets mkfr + * + * @param string|null $mkfr Maker fee + * + * @return $this + */ + public function setMkfr($mkfr) + { + $this->container['mkfr'] = $mkfr; + + return $this; + } + + /** + * Gets refu + * + * @return int|null + */ + public function getRefu() + { + return $this->container['refu']; + } + + /** + * Sets refu + * + * @param int|null $refu Reference user ID + * + * @return $this + */ + public function setRefu($refu) + { + $this->container['refu'] = $refu; + + return $this; + } + + /** + * Gets auto_size + * + * @return string|null + */ + public function getAutoSize() + { + return $this->container['auto_size']; + } + + /** + * Sets auto_size + * + * @param string|null $auto_size Set side to close dual-mode position. `close_long` closes the long side; while `close_short` the short one. Note `size` also needs to be set to 0 + * + * @return $this + */ + public function setAutoSize($auto_size) + { + $allowedValues = $this->getAutoSizeAllowableValues(); + if (!is_null($auto_size) && !in_array($auto_size, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'auto_size', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['auto_size'] = $auto_size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BatchOrder.php b/src/Model/BatchOrder.php index 93bf1f8..f4386b3 100644 --- a/src/Model/BatchOrder.php +++ b/src/Model/BatchOrder.php @@ -43,17 +43,17 @@ class BatchOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'BatchOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'text' => 'string', 'succeeded' => 'bool', @@ -88,10 +88,10 @@ class BatchOrder implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'text' => null, 'succeeded' => null, @@ -305,6 +305,7 @@ public function getModelName() const STATUS_CLOSED = 'closed'; const STATUS_CANCELLED = 'cancelled'; const TYPE_LIMIT = 'limit'; + const TYPE_MARKET = 'market'; const ACCOUNT_SPOT = 'spot'; const ACCOUNT_MARGIN = 'margin'; const ACCOUNT_CROSS_MARGIN = 'cross_margin'; @@ -313,6 +314,7 @@ public function getModelName() const TIME_IN_FORCE_GTC = 'gtc'; const TIME_IN_FORCE_IOC = 'ioc'; const TIME_IN_FORCE_POC = 'poc'; + const TIME_IN_FORCE_FOK = 'fok'; @@ -339,6 +341,7 @@ public function getTypeAllowableValues() { return [ self::TYPE_LIMIT, + self::TYPE_MARKET, ]; } @@ -380,6 +383,7 @@ public function getTimeInForceAllowableValues() self::TIME_IN_FORCE_GTC, self::TIME_IN_FORCE_IOC, self::TIME_IN_FORCE_POC, + self::TIME_IN_FORCE_FOK, ]; } @@ -532,7 +536,7 @@ public function getSucceeded() /** * Sets succeeded * - * @param bool|null $succeeded Whether order succeeds + * @param bool|null $succeeded Whether the batch of orders succeeded * * @return $this */ @@ -556,7 +560,7 @@ public function getLabel() /** * Sets label * - * @param string|null $label Error label, empty string if order succeeds + * @param string|null $label Error label, if any, otherwise an empty string * * @return $this */ @@ -580,7 +584,7 @@ public function getMessage() /** * Sets message * - * @param string|null $message Detailed error message, empty string if order succeeds + * @param string|null $message Detailed error message, if any, otherwise an empty string * * @return $this */ @@ -628,7 +632,7 @@ public function getCreateTime() /** * Sets create_time * - * @param string|null $create_time Order creation time + * @param string|null $create_time Creation time of order * * @return $this */ @@ -652,7 +656,7 @@ public function getUpdateTime() /** * Sets update_time * - * @param string|null $update_time Order last modification time + * @param string|null $update_time Last modification time of order * * @return $this */ @@ -676,7 +680,7 @@ public function getCreateTimeMs() /** * Sets create_time_ms * - * @param int|null $create_time_ms Order creation time in milliseconds + * @param int|null $create_time_ms Creation time of order (in milliseconds) * * @return $this */ @@ -700,7 +704,7 @@ public function getUpdateTimeMs() /** * Sets update_time_ms * - * @param int|null $update_time_ms Order last modification time in milliseconds + * @param int|null $update_time_ms Last modification time of order (in milliseconds) * * @return $this */ @@ -781,7 +785,7 @@ public function getType() /** * Sets type * - * @param string|null $type Order type. limit - limit order + * @param string|null $type Order Type - limit : Limit Order - market : Market Order * * @return $this */ @@ -928,7 +932,7 @@ public function getTimeInForce() /** * Sets time_in_force * - * @param string|null $time_in_force Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee + * @param string|null $time_in_force Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none * * @return $this */ @@ -961,7 +965,7 @@ public function getIceberg() /** * Sets iceberg * - * @param string|null $iceberg Amount to display for the iceberg order. Null or 0 for normal orders. Set to -1 to hide the amount totally + * @param string|null $iceberg Amount to display for the iceberg order. Null or 0 for normal orders. Hiding all amount is not supported. * * @return $this */ @@ -1153,7 +1157,7 @@ public function getPointFee() /** * Sets point_fee * - * @param string|null $point_fee Point used to deduct fee + * @param string|null $point_fee Points used to deduct fee * * @return $this */ @@ -1266,7 +1270,7 @@ public function setRebatedFeeCurrency($rebated_fee_currency) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1278,9 +1282,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -1291,7 +1296,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1307,7 +1312,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CancelOrder.php b/src/Model/CancelOrder.php index 7e58653..16e7218 100644 --- a/src/Model/CancelOrder.php +++ b/src/Model/CancelOrder.php @@ -43,17 +43,17 @@ class CancelOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CancelOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency_pair' => 'string', 'id' => 'string', @@ -61,10 +61,10 @@ class CancelOrder implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency_pair' => null, 'id' => null, @@ -281,7 +281,7 @@ public function getAccount() /** * Sets account * - * @param string|null $account If cancelled order is cross margin order, this field must be set and can only be `cross_margin` + * @param string|null $account If cancelled order is cross margin order or is portfolio margin account's API key, this field must be set and can only be `cross_margin`If cancelled order is cross margin order, this field must be set and can only be `cross_margin` * * @return $this */ @@ -298,7 +298,7 @@ public function setAccount($account) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -310,9 +310,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -323,7 +324,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -339,7 +340,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CancelOrderResult.php b/src/Model/CancelOrderResult.php index f4e1b2d..9e0e746 100644 --- a/src/Model/CancelOrderResult.php +++ b/src/Model/CancelOrderResult.php @@ -43,17 +43,17 @@ class CancelOrderResult implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CancelOrderResult'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency_pair' => 'string', 'id' => 'string', @@ -64,10 +64,10 @@ class CancelOrderResult implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency_pair' => null, 'id' => null, @@ -382,7 +382,7 @@ public function setAccount($account) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,9 +394,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -407,7 +408,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -423,7 +424,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/Contract.php b/src/Model/Contract.php index 69caab8..d476363 100644 --- a/src/Model/Contract.php +++ b/src/Model/Contract.php @@ -33,7 +33,7 @@ * Contract Class Doc Comment * * @category Class - * @description Contract detail. USD value per contract: - USDT settled contracts: `quanto_multiplier x token price` - BTC settled contracts:`quanto_multiplier x BTC price x token price` + * @description Futures contract details * @package GateApi * @author GateIO * @link https://www.gate.io @@ -43,17 +43,17 @@ class Contract implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Contract'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'type' => 'string', @@ -86,14 +86,16 @@ class Contract implements ModelInterface, ArrayAccess 'position_size' => 'int', 'config_change_time' => 'double', 'in_delisting' => 'bool', - 'orders_limit' => 'int' + 'orders_limit' => 'int', + 'enable_bonus' => 'bool', + 'enable_credit' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'name' => null, 'type' => null, @@ -126,7 +128,9 @@ class Contract implements ModelInterface, ArrayAccess 'position_size' => 'int64', 'config_change_time' => 'double', 'in_delisting' => null, - 'orders_limit' => null + 'orders_limit' => null, + 'enable_bonus' => null, + 'enable_credit' => null ]; /** @@ -187,7 +191,9 @@ public static function openAPIFormats() 'position_size' => 'position_size', 'config_change_time' => 'config_change_time', 'in_delisting' => 'in_delisting', - 'orders_limit' => 'orders_limit' + 'orders_limit' => 'orders_limit', + 'enable_bonus' => 'enable_bonus', + 'enable_credit' => 'enable_credit' ]; /** @@ -227,7 +233,9 @@ public static function openAPIFormats() 'position_size' => 'setPositionSize', 'config_change_time' => 'setConfigChangeTime', 'in_delisting' => 'setInDelisting', - 'orders_limit' => 'setOrdersLimit' + 'orders_limit' => 'setOrdersLimit', + 'enable_bonus' => 'setEnableBonus', + 'enable_credit' => 'setEnableCredit' ]; /** @@ -267,7 +275,9 @@ public static function openAPIFormats() 'position_size' => 'getPositionSize', 'config_change_time' => 'getConfigChangeTime', 'in_delisting' => 'getInDelisting', - 'orders_limit' => 'getOrdersLimit' + 'orders_limit' => 'getOrdersLimit', + 'enable_bonus' => 'getEnableBonus', + 'enable_credit' => 'getEnableCredit' ]; /** @@ -392,6 +402,8 @@ public function __construct(array $data = null) $this->container['config_change_time'] = isset($data['config_change_time']) ? $data['config_change_time'] : null; $this->container['in_delisting'] = isset($data['in_delisting']) ? $data['in_delisting'] : null; $this->container['orders_limit'] = isset($data['orders_limit']) ? $data['orders_limit'] : null; + $this->container['enable_bonus'] = isset($data['enable_bonus']) ? $data['enable_bonus'] : null; + $this->container['enable_credit'] = isset($data['enable_credit']) ? $data['enable_credit'] : null; } /** @@ -1113,7 +1125,7 @@ public function getTradeSize() /** * Sets trade_size * - * @param int|null $trade_size Historical accumulation trade size + * @param int|null $trade_size Historical accumulated trade size * * @return $this */ @@ -1161,7 +1173,7 @@ public function getConfigChangeTime() /** * Sets config_change_time * - * @param double|null $config_change_time Configuration's last changed time + * @param double|null $config_change_time Last changed time of configuration * * @return $this */ @@ -1219,6 +1231,54 @@ public function setOrdersLimit($orders_limit) return $this; } + + /** + * Gets enable_bonus + * + * @return bool|null + */ + public function getEnableBonus() + { + return $this->container['enable_bonus']; + } + + /** + * Sets enable_bonus + * + * @param bool|null $enable_bonus Whether bouns is enabled + * + * @return $this + */ + public function setEnableBonus($enable_bonus) + { + $this->container['enable_bonus'] = $enable_bonus; + + return $this; + } + + /** + * Gets enable_credit + * + * @return bool|null + */ + public function getEnableCredit() + { + return $this->container['enable_credit']; + } + + /** + * Sets enable_credit + * + * @param bool|null $enable_credit Whether portfolio margin account is enabled + * + * @return $this + */ + public function setEnableCredit($enable_credit) + { + $this->container['enable_credit'] = $enable_credit; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -1226,7 +1286,7 @@ public function setOrdersLimit($orders_limit) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1238,9 +1298,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -1251,7 +1312,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1267,7 +1328,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/ContractStat.php b/src/Model/ContractStat.php index 7646c32..622a011 100644 --- a/src/Model/ContractStat.php +++ b/src/Model/ContractStat.php @@ -42,17 +42,17 @@ class ContractStat implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'ContractStat'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'time' => 'int', 'lsr_taker' => 'float', @@ -70,10 +70,10 @@ class ContractStat implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'time' => 'int64', 'lsr_taker' => null, @@ -591,7 +591,7 @@ public function setTopLsrSize($top_lsr_size) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -603,9 +603,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -616,7 +617,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -632,7 +633,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CountdownCancelAllFuturesTask.php b/src/Model/CountdownCancelAllFuturesTask.php new file mode 100644 index 0000000..9823c90 --- /dev/null +++ b/src/Model/CountdownCancelAllFuturesTask.php @@ -0,0 +1,339 @@ + 'int', + 'contract' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'timeout' => 'int32', + 'contract' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'timeout' => 'timeout', + 'contract' => 'contract' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'timeout' => 'setTimeout', + 'contract' => 'setContract' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'timeout' => 'getTimeout', + 'contract' => 'getContract' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['timeout'] = isset($data['timeout']) ? $data['timeout'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' 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 timeout + * + * @return int + */ + public function getTimeout() + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param int $timeout Countdown time, in seconds At least 5 seconds, 0 means cancel the countdown + * + * @return $this + */ + public function setTimeout($timeout) + { + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Futures contract + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CountdownCancelAllSpotTask.php b/src/Model/CountdownCancelAllSpotTask.php new file mode 100644 index 0000000..28f1ae0 --- /dev/null +++ b/src/Model/CountdownCancelAllSpotTask.php @@ -0,0 +1,339 @@ + 'int', + 'currency_pair' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'timeout' => 'int32', + 'currency_pair' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'timeout' => 'timeout', + 'currency_pair' => 'currency_pair' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'timeout' => 'setTimeout', + 'currency_pair' => 'setCurrencyPair' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'timeout' => 'getTimeout', + 'currency_pair' => 'getCurrencyPair' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['timeout'] = isset($data['timeout']) ? $data['timeout'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['timeout'] === null) { + $invalidProperties[] = "'timeout' 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 timeout + * + * @return int + */ + public function getTimeout() + { + return $this->container['timeout']; + } + + /** + * Sets timeout + * + * @param int $timeout Countdown time, in seconds At least 5 seconds, 0 means cancel the countdown + * + * @return $this + */ + public function setTimeout($timeout) + { + $this->container['timeout'] = $timeout; + + return $this; + } + + /** + * Gets currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CrossMarginAccount.php b/src/Model/CrossMarginAccount.php index f3053dc..68dd964 100644 --- a/src/Model/CrossMarginAccount.php +++ b/src/Model/CrossMarginAccount.php @@ -42,17 +42,17 @@ class CrossMarginAccount implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CrossMarginAccount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'user_id' => 'int', 'locked' => 'bool', @@ -60,14 +60,21 @@ class CrossMarginAccount implements ModelInterface, ArrayAccess 'total' => 'string', 'borrowed' => 'string', 'interest' => 'string', - 'risk' => 'string' + 'risk' => 'string', + 'total_initial_margin' => 'string', + 'total_margin_balance' => 'string', + 'total_maintenance_margin' => 'string', + 'total_initial_margin_rate' => 'string', + 'total_maintenance_margin_rate' => 'string', + 'total_available_margin' => 'string', + 'portfolio_margin_total' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'user_id' => 'int64', 'locked' => null, @@ -75,7 +82,14 @@ class CrossMarginAccount implements ModelInterface, ArrayAccess 'total' => null, 'borrowed' => null, 'interest' => null, - 'risk' => null + 'risk' => null, + 'total_initial_margin' => null, + 'total_margin_balance' => null, + 'total_maintenance_margin' => null, + 'total_initial_margin_rate' => null, + 'total_maintenance_margin_rate' => null, + 'total_available_margin' => null, + 'portfolio_margin_total' => null ]; /** @@ -111,7 +125,14 @@ public static function openAPIFormats() 'total' => 'total', 'borrowed' => 'borrowed', 'interest' => 'interest', - 'risk' => 'risk' + 'risk' => 'risk', + 'total_initial_margin' => 'total_initial_margin', + 'total_margin_balance' => 'total_margin_balance', + 'total_maintenance_margin' => 'total_maintenance_margin', + 'total_initial_margin_rate' => 'total_initial_margin_rate', + 'total_maintenance_margin_rate' => 'total_maintenance_margin_rate', + 'total_available_margin' => 'total_available_margin', + 'portfolio_margin_total' => 'portfolio_margin_total' ]; /** @@ -126,7 +147,14 @@ public static function openAPIFormats() 'total' => 'setTotal', 'borrowed' => 'setBorrowed', 'interest' => 'setInterest', - 'risk' => 'setRisk' + 'risk' => 'setRisk', + 'total_initial_margin' => 'setTotalInitialMargin', + 'total_margin_balance' => 'setTotalMarginBalance', + 'total_maintenance_margin' => 'setTotalMaintenanceMargin', + 'total_initial_margin_rate' => 'setTotalInitialMarginRate', + 'total_maintenance_margin_rate' => 'setTotalMaintenanceMarginRate', + 'total_available_margin' => 'setTotalAvailableMargin', + 'portfolio_margin_total' => 'setPortfolioMarginTotal' ]; /** @@ -141,7 +169,14 @@ public static function openAPIFormats() 'total' => 'getTotal', 'borrowed' => 'getBorrowed', 'interest' => 'getInterest', - 'risk' => 'getRisk' + 'risk' => 'getRisk', + 'total_initial_margin' => 'getTotalInitialMargin', + 'total_margin_balance' => 'getTotalMarginBalance', + 'total_maintenance_margin' => 'getTotalMaintenanceMargin', + 'total_initial_margin_rate' => 'getTotalInitialMarginRate', + 'total_maintenance_margin_rate' => 'getTotalMaintenanceMarginRate', + 'total_available_margin' => 'getTotalAvailableMargin', + 'portfolio_margin_total' => 'getPortfolioMarginTotal' ]; /** @@ -211,6 +246,13 @@ public function __construct(array $data = null) $this->container['borrowed'] = isset($data['borrowed']) ? $data['borrowed'] : null; $this->container['interest'] = isset($data['interest']) ? $data['interest'] : null; $this->container['risk'] = isset($data['risk']) ? $data['risk'] : null; + $this->container['total_initial_margin'] = isset($data['total_initial_margin']) ? $data['total_initial_margin'] : null; + $this->container['total_margin_balance'] = isset($data['total_margin_balance']) ? $data['total_margin_balance'] : null; + $this->container['total_maintenance_margin'] = isset($data['total_maintenance_margin']) ? $data['total_maintenance_margin'] : null; + $this->container['total_initial_margin_rate'] = isset($data['total_initial_margin_rate']) ? $data['total_initial_margin_rate'] : null; + $this->container['total_maintenance_margin_rate'] = isset($data['total_maintenance_margin_rate']) ? $data['total_maintenance_margin_rate'] : null; + $this->container['total_available_margin'] = isset($data['total_available_margin']) ? $data['total_available_margin'] : null; + $this->container['portfolio_margin_total'] = isset($data['portfolio_margin_total']) ? $data['portfolio_margin_total'] : null; } /** @@ -404,6 +446,174 @@ public function setRisk($risk) return $this; } + + /** + * Gets total_initial_margin + * + * @return string|null + */ + public function getTotalInitialMargin() + { + return $this->container['total_initial_margin']; + } + + /** + * Sets total_initial_margin + * + * @param string|null $total_initial_margin Total initial margin + * + * @return $this + */ + public function setTotalInitialMargin($total_initial_margin) + { + $this->container['total_initial_margin'] = $total_initial_margin; + + return $this; + } + + /** + * Gets total_margin_balance + * + * @return string|null + */ + public function getTotalMarginBalance() + { + return $this->container['total_margin_balance']; + } + + /** + * Sets total_margin_balance + * + * @param string|null $total_margin_balance Total margin balance + * + * @return $this + */ + public function setTotalMarginBalance($total_margin_balance) + { + $this->container['total_margin_balance'] = $total_margin_balance; + + return $this; + } + + /** + * Gets total_maintenance_margin + * + * @return string|null + */ + public function getTotalMaintenanceMargin() + { + return $this->container['total_maintenance_margin']; + } + + /** + * Sets total_maintenance_margin + * + * @param string|null $total_maintenance_margin Total maintenance margin + * + * @return $this + */ + public function setTotalMaintenanceMargin($total_maintenance_margin) + { + $this->container['total_maintenance_margin'] = $total_maintenance_margin; + + return $this; + } + + /** + * Gets total_initial_margin_rate + * + * @return string|null + */ + public function getTotalInitialMarginRate() + { + return $this->container['total_initial_margin_rate']; + } + + /** + * Sets total_initial_margin_rate + * + * @param string|null $total_initial_margin_rate Total initial margin rate + * + * @return $this + */ + public function setTotalInitialMarginRate($total_initial_margin_rate) + { + $this->container['total_initial_margin_rate'] = $total_initial_margin_rate; + + return $this; + } + + /** + * Gets total_maintenance_margin_rate + * + * @return string|null + */ + public function getTotalMaintenanceMarginRate() + { + return $this->container['total_maintenance_margin_rate']; + } + + /** + * Sets total_maintenance_margin_rate + * + * @param string|null $total_maintenance_margin_rate Total maintenance margin rate + * + * @return $this + */ + public function setTotalMaintenanceMarginRate($total_maintenance_margin_rate) + { + $this->container['total_maintenance_margin_rate'] = $total_maintenance_margin_rate; + + return $this; + } + + /** + * Gets total_available_margin + * + * @return string|null + */ + public function getTotalAvailableMargin() + { + return $this->container['total_available_margin']; + } + + /** + * Sets total_available_margin + * + * @param string|null $total_available_margin Total available margin + * + * @return $this + */ + public function setTotalAvailableMargin($total_available_margin) + { + $this->container['total_available_margin'] = $total_available_margin; + + return $this; + } + + /** + * Gets portfolio_margin_total + * + * @return string|null + */ + public function getPortfolioMarginTotal() + { + return $this->container['portfolio_margin_total']; + } + + /** + * Sets portfolio_margin_total + * + * @param string|null $portfolio_margin_total Total amount of the portfolio margin account + * + * @return $this + */ + public function setPortfolioMarginTotal($portfolio_margin_total) + { + $this->container['portfolio_margin_total'] = $portfolio_margin_total; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -411,7 +621,7 @@ public function setRisk($risk) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -423,9 +633,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -436,7 +647,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -452,7 +663,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CrossMarginAccountBook.php b/src/Model/CrossMarginAccountBook.php new file mode 100644 index 0000000..a6a1b67 --- /dev/null +++ b/src/Model/CrossMarginAccountBook.php @@ -0,0 +1,503 @@ + 'string', + 'time' => 'int', + 'currency' => 'string', + 'change' => 'string', + 'balance' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => null, + 'time' => 'int64', + 'currency' => null, + 'change' => null, + 'balance' => null, + 'type' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'time' => 'time', + 'currency' => 'currency', + 'change' => 'change', + 'balance' => 'balance', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'time' => 'setTime', + 'currency' => 'setCurrency', + 'change' => 'setChange', + 'balance' => 'setBalance', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'time' => 'getTime', + 'currency' => 'getCurrency', + 'change' => 'getChange', + 'balance' => 'getBalance', + 'type' => 'getType' + ]; + + /** + * 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::$openAPIModelName; + } + + const TYPE_IN = 'in'; + const TYPE_OUT = 'out'; + const TYPE_REPAY = 'repay'; + const TYPE_BORROW = 'borrow'; + const TYPE_INTEREST = 'interest'; + const TYPE_NEW_ORDER = 'new_order'; + const TYPE_ORDER_FILL = 'order_fill'; + const TYPE_REFERRAL_FEE = 'referral_fee'; + const TYPE_ORDER_FEE = 'order_fee'; + const TYPE_UNKNOWN = 'unknown'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_IN, + self::TYPE_OUT, + self::TYPE_REPAY, + self::TYPE_BORROW, + self::TYPE_INTEREST, + self::TYPE_NEW_ORDER, + self::TYPE_ORDER_FILL, + self::TYPE_REFERRAL_FEE, + self::TYPE_ORDER_FEE, + self::TYPE_UNKNOWN, + ]; + } + + + /** + * 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['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['change'] = isset($data['change']) ? $data['change'] : null; + $this->container['balance'] = isset($data['balance']) ? $data['balance'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'type', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Balance change record ID + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets time + * + * @return int|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param int|null $time The timestamp of the change (in milliseconds) + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency changed + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets change + * + * @return string|null + */ + public function getChange() + { + return $this->container['change']; + } + + /** + * Sets change + * + * @param string|null $change Amount changed. Positive value means transferring in, while negative out + * + * @return $this + */ + public function setChange($change) + { + $this->container['change'] = $change; + + return $this; + } + + /** + * Gets balance + * + * @return string|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param string|null $balance Balance after change + * + * @return $this + */ + public function setBalance($balance) + { + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Account change type, including: - in: transferals into cross margin account - out: transferals out from cross margin account - repay: loan repayment - borrow: borrowed loan - interest: interest - new_order: new order locked - order_fill: order fills - referral_fee: fee refund from referrals - order_fee: order fee generated from fills - unknown: unknown type + * + * @return $this + */ + public function setType($type) + { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'type', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CrossMarginBalance.php b/src/Model/CrossMarginBalance.php index 338ddf9..6c47acc 100644 --- a/src/Model/CrossMarginBalance.php +++ b/src/Model/CrossMarginBalance.php @@ -42,17 +42,17 @@ class CrossMarginBalance implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CrossMarginBalance'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'available' => 'string', 'freeze' => 'string', @@ -61,10 +61,10 @@ class CrossMarginBalance implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'available' => null, 'freeze' => null, @@ -304,7 +304,7 @@ public function getInterest() /** * Sets interest * - * @param string|null $interest Interests unpaid + * @param string|null $interest Unpaid interests * * @return $this */ @@ -321,7 +321,7 @@ public function setInterest($interest) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -333,9 +333,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -346,7 +347,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -362,7 +363,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CrossMarginBorrowable.php b/src/Model/CrossMarginBorrowable.php new file mode 100644 index 0000000..94a7270 --- /dev/null +++ b/src/Model/CrossMarginBorrowable.php @@ -0,0 +1,335 @@ + 'string', + 'amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'amount' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'amount' => 'getAmount' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency detail + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Max borrowable amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CrossMarginCurrency.php b/src/Model/CrossMarginCurrency.php index bfb4df9..1c970bf 100644 --- a/src/Model/CrossMarginCurrency.php +++ b/src/Model/CrossMarginCurrency.php @@ -42,17 +42,17 @@ class CrossMarginCurrency implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CrossMarginCurrency'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'rate' => 'string', @@ -61,14 +61,15 @@ class CrossMarginCurrency implements ModelInterface, ArrayAccess 'min_borrow_amount' => 'string', 'user_max_borrow_amount' => 'string', 'total_max_borrow_amount' => 'string', - 'price' => 'string' + 'price' => 'string', + 'status' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'name' => null, 'rate' => null, @@ -77,7 +78,8 @@ class CrossMarginCurrency implements ModelInterface, ArrayAccess 'min_borrow_amount' => null, 'user_max_borrow_amount' => null, 'total_max_borrow_amount' => null, - 'price' => null + 'price' => null, + 'status' => null ]; /** @@ -114,7 +116,8 @@ public static function openAPIFormats() 'min_borrow_amount' => 'min_borrow_amount', 'user_max_borrow_amount' => 'user_max_borrow_amount', 'total_max_borrow_amount' => 'total_max_borrow_amount', - 'price' => 'price' + 'price' => 'price', + 'status' => 'status' ]; /** @@ -130,7 +133,8 @@ public static function openAPIFormats() 'min_borrow_amount' => 'setMinBorrowAmount', 'user_max_borrow_amount' => 'setUserMaxBorrowAmount', 'total_max_borrow_amount' => 'setTotalMaxBorrowAmount', - 'price' => 'setPrice' + 'price' => 'setPrice', + 'status' => 'setStatus' ]; /** @@ -146,7 +150,8 @@ public static function openAPIFormats() 'min_borrow_amount' => 'getMinBorrowAmount', 'user_max_borrow_amount' => 'getUserMaxBorrowAmount', 'total_max_borrow_amount' => 'getTotalMaxBorrowAmount', - 'price' => 'getPrice' + 'price' => 'getPrice', + 'status' => 'getStatus' ]; /** @@ -217,6 +222,7 @@ public function __construct(array $data = null) $this->container['user_max_borrow_amount'] = isset($data['user_max_borrow_amount']) ? $data['user_max_borrow_amount'] : null; $this->container['total_max_borrow_amount'] = isset($data['total_max_borrow_amount']) ? $data['total_max_borrow_amount'] : null; $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; } /** @@ -280,7 +286,7 @@ public function getRate() /** * Sets rate * - * @param string|null $rate Loan rate + * @param string|null $rate Minimum lending rate (hourly rate) * * @return $this */ @@ -434,6 +440,30 @@ public function setPrice($price) return $this; } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status status - `0` : disable - `1` : enable + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -441,7 +471,7 @@ public function setPrice($price) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -453,9 +483,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -466,7 +497,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -482,7 +513,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CrossMarginLoan.php b/src/Model/CrossMarginLoan.php index 588c0fa..b81cc0e 100644 --- a/src/Model/CrossMarginLoan.php +++ b/src/Model/CrossMarginLoan.php @@ -42,17 +42,17 @@ class CrossMarginLoan implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CrossMarginLoan'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'create_time' => 'int', @@ -67,10 +67,10 @@ class CrossMarginLoan implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'create_time' => 'int64', @@ -78,7 +78,7 @@ class CrossMarginLoan implements ModelInterface, ArrayAccess 'currency' => null, 'amount' => null, 'text' => null, - 'status' => null, + 'status' => 'int32', 'repaid' => null, 'repaid_interest' => null, 'unpaid_interest' => null @@ -524,7 +524,7 @@ public function getUnpaidInterest() /** * Sets unpaid_interest * - * @param string|null $unpaid_interest Interest not repaid + * @param string|null $unpaid_interest Outstanding interest yet to be paid * * @return $this */ @@ -541,7 +541,7 @@ public function setUnpaidInterest($unpaid_interest) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -553,9 +553,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -566,7 +567,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -582,7 +583,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CrossMarginRepayRequest.php b/src/Model/CrossMarginRepayRequest.php index 3767471..9585de6 100644 --- a/src/Model/CrossMarginRepayRequest.php +++ b/src/Model/CrossMarginRepayRequest.php @@ -42,27 +42,27 @@ class CrossMarginRepayRequest implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CrossMarginRepayRequest'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'amount' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'amount' => null @@ -267,7 +267,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -279,9 +279,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -292,7 +293,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -308,7 +309,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CrossMarginRepayment.php b/src/Model/CrossMarginRepayment.php index be9b2ec..1808b94 100644 --- a/src/Model/CrossMarginRepayment.php +++ b/src/Model/CrossMarginRepayment.php @@ -42,17 +42,17 @@ class CrossMarginRepayment implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CrossMarginRepayment'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'create_time' => 'int', @@ -63,10 +63,10 @@ class CrossMarginRepayment implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'create_time' => 'int64', @@ -381,7 +381,7 @@ public function setInterest($interest) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -393,9 +393,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -406,7 +407,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -422,7 +423,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CrossMarginTransferable.php b/src/Model/CrossMarginTransferable.php new file mode 100644 index 0000000..adfe6f3 --- /dev/null +++ b/src/Model/CrossMarginTransferable.php @@ -0,0 +1,335 @@ + 'string', + 'amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'amount' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'amount' => 'getAmount' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency detail + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Max transferable amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Currency.php b/src/Model/Currency.php index ec6dcf4..61a7425 100644 --- a/src/Model/Currency.php +++ b/src/Model/Currency.php @@ -42,38 +42,42 @@ class Currency implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Currency'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'delisted' => 'bool', 'withdraw_disabled' => 'bool', 'withdraw_delayed' => 'bool', 'deposit_disabled' => 'bool', - 'trade_disabled' => 'bool' + 'trade_disabled' => 'bool', + 'fixed_rate' => 'string', + 'chain' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'delisted' => null, 'withdraw_disabled' => null, 'withdraw_delayed' => null, 'deposit_disabled' => null, - 'trade_disabled' => null + 'trade_disabled' => null, + 'fixed_rate' => null, + 'chain' => null ]; /** @@ -108,7 +112,9 @@ public static function openAPIFormats() 'withdraw_disabled' => 'withdraw_disabled', 'withdraw_delayed' => 'withdraw_delayed', 'deposit_disabled' => 'deposit_disabled', - 'trade_disabled' => 'trade_disabled' + 'trade_disabled' => 'trade_disabled', + 'fixed_rate' => 'fixed_rate', + 'chain' => 'chain' ]; /** @@ -122,7 +128,9 @@ public static function openAPIFormats() 'withdraw_disabled' => 'setWithdrawDisabled', 'withdraw_delayed' => 'setWithdrawDelayed', 'deposit_disabled' => 'setDepositDisabled', - 'trade_disabled' => 'setTradeDisabled' + 'trade_disabled' => 'setTradeDisabled', + 'fixed_rate' => 'setFixedRate', + 'chain' => 'setChain' ]; /** @@ -136,7 +144,9 @@ public static function openAPIFormats() 'withdraw_disabled' => 'getWithdrawDisabled', 'withdraw_delayed' => 'getWithdrawDelayed', 'deposit_disabled' => 'getDepositDisabled', - 'trade_disabled' => 'getTradeDisabled' + 'trade_disabled' => 'getTradeDisabled', + 'fixed_rate' => 'getFixedRate', + 'chain' => 'getChain' ]; /** @@ -205,6 +215,8 @@ public function __construct(array $data = null) $this->container['withdraw_delayed'] = isset($data['withdraw_delayed']) ? $data['withdraw_delayed'] : null; $this->container['deposit_disabled'] = isset($data['deposit_disabled']) ? $data['deposit_disabled'] : null; $this->container['trade_disabled'] = isset($data['trade_disabled']) ? $data['trade_disabled'] : null; + $this->container['fixed_rate'] = isset($data['fixed_rate']) ? $data['fixed_rate'] : null; + $this->container['chain'] = isset($data['chain']) ? $data['chain'] : null; } /** @@ -374,6 +386,54 @@ public function setTradeDisabled($trade_disabled) return $this; } + + /** + * Gets fixed_rate + * + * @return string|null + */ + public function getFixedRate() + { + return $this->container['fixed_rate']; + } + + /** + * Sets fixed_rate + * + * @param string|null $fixed_rate Fixed fee rate. Only for fixed rate currencies, not valid for normal currencies + * + * @return $this + */ + public function setFixedRate($fixed_rate) + { + $this->container['fixed_rate'] = $fixed_rate; + + return $this; + } + + /** + * Gets chain + * + * @return string|null + */ + public function getChain() + { + return $this->container['chain']; + } + + /** + * Sets chain + * + * @param string|null $chain Chain of currency + * + * @return $this + */ + public function setChain($chain) + { + $this->container['chain'] = $chain; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -381,7 +441,7 @@ public function setTradeDisabled($trade_disabled) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -393,9 +453,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -406,7 +467,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -422,7 +483,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/CurrencyChain.php b/src/Model/CurrencyChain.php new file mode 100644 index 0000000..ac594dc --- /dev/null +++ b/src/Model/CurrencyChain.php @@ -0,0 +1,455 @@ + 'string', + 'name_cn' => 'string', + 'name_en' => 'string', + 'is_disabled' => 'int', + 'is_deposit_disabled' => 'int', + 'is_withdraw_disabled' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'chain' => null, + 'name_cn' => null, + 'name_en' => null, + 'is_disabled' => null, + 'is_deposit_disabled' => null, + 'is_withdraw_disabled' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'chain' => 'chain', + 'name_cn' => 'name_cn', + 'name_en' => 'name_en', + 'is_disabled' => 'is_disabled', + 'is_deposit_disabled' => 'is_deposit_disabled', + 'is_withdraw_disabled' => 'is_withdraw_disabled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'chain' => 'setChain', + 'name_cn' => 'setNameCn', + 'name_en' => 'setNameEn', + 'is_disabled' => 'setIsDisabled', + 'is_deposit_disabled' => 'setIsDepositDisabled', + 'is_withdraw_disabled' => 'setIsWithdrawDisabled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'chain' => 'getChain', + 'name_cn' => 'getNameCn', + 'name_en' => 'getNameEn', + 'is_disabled' => 'getIsDisabled', + 'is_deposit_disabled' => 'getIsDepositDisabled', + 'is_withdraw_disabled' => 'getIsWithdrawDisabled' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['chain'] = isset($data['chain']) ? $data['chain'] : null; + $this->container['name_cn'] = isset($data['name_cn']) ? $data['name_cn'] : null; + $this->container['name_en'] = isset($data['name_en']) ? $data['name_en'] : null; + $this->container['is_disabled'] = isset($data['is_disabled']) ? $data['is_disabled'] : null; + $this->container['is_deposit_disabled'] = isset($data['is_deposit_disabled']) ? $data['is_deposit_disabled'] : null; + $this->container['is_withdraw_disabled'] = isset($data['is_withdraw_disabled']) ? $data['is_withdraw_disabled'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 chain + * + * @return string|null + */ + public function getChain() + { + return $this->container['chain']; + } + + /** + * Sets chain + * + * @param string|null $chain Chain name + * + * @return $this + */ + public function setChain($chain) + { + $this->container['chain'] = $chain; + + return $this; + } + + /** + * Gets name_cn + * + * @return string|null + */ + public function getNameCn() + { + return $this->container['name_cn']; + } + + /** + * Sets name_cn + * + * @param string|null $name_cn Chain name in Chinese + * + * @return $this + */ + public function setNameCn($name_cn) + { + $this->container['name_cn'] = $name_cn; + + return $this; + } + + /** + * Gets name_en + * + * @return string|null + */ + public function getNameEn() + { + return $this->container['name_en']; + } + + /** + * Sets name_en + * + * @param string|null $name_en Chain name in English + * + * @return $this + */ + public function setNameEn($name_en) + { + $this->container['name_en'] = $name_en; + + return $this; + } + + /** + * Gets is_disabled + * + * @return int|null + */ + public function getIsDisabled() + { + return $this->container['is_disabled']; + } + + /** + * Sets is_disabled + * + * @param int|null $is_disabled If it is disabled. 0 means NOT being disabled + * + * @return $this + */ + public function setIsDisabled($is_disabled) + { + $this->container['is_disabled'] = $is_disabled; + + return $this; + } + + /** + * Gets is_deposit_disabled + * + * @return int|null + */ + public function getIsDepositDisabled() + { + return $this->container['is_deposit_disabled']; + } + + /** + * Sets is_deposit_disabled + * + * @param int|null $is_deposit_disabled Is deposit disabled. 0 means not + * + * @return $this + */ + public function setIsDepositDisabled($is_deposit_disabled) + { + $this->container['is_deposit_disabled'] = $is_deposit_disabled; + + return $this; + } + + /** + * Gets is_withdraw_disabled + * + * @return int|null + */ + public function getIsWithdrawDisabled() + { + return $this->container['is_withdraw_disabled']; + } + + /** + * Sets is_withdraw_disabled + * + * @param int|null $is_withdraw_disabled Is withdrawal disabled. 0 means not + * + * @return $this + */ + public function setIsWithdrawDisabled($is_withdraw_disabled) + { + $this->container['is_withdraw_disabled'] = $is_withdraw_disabled; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CurrencyPair.php b/src/Model/CurrencyPair.php index d529adb..adcf004 100644 --- a/src/Model/CurrencyPair.php +++ b/src/Model/CurrencyPair.php @@ -43,17 +43,17 @@ class CurrencyPair implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'CurrencyPair'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'base' => 'string', @@ -69,10 +69,10 @@ class CurrencyPair implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'base' => null, @@ -568,7 +568,7 @@ public function setBuyStart($buy_start) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -580,9 +580,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -593,7 +594,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -609,7 +610,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/DeliveryContract.php b/src/Model/DeliveryContract.php index e97fd70..f3cbaae 100644 --- a/src/Model/DeliveryContract.php +++ b/src/Model/DeliveryContract.php @@ -43,17 +43,17 @@ class DeliveryContract implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'DeliveryContract'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'underlying' => 'string', @@ -96,10 +96,10 @@ class DeliveryContract implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'name' => null, 'underlying' => null, @@ -1329,7 +1329,7 @@ public function getTradeSize() /** * Sets trade_size * - * @param int|null $trade_size Historical accumulation trade size + * @param int|null $trade_size Historical accumulated trade size * * @return $this */ @@ -1377,7 +1377,7 @@ public function getConfigChangeTime() /** * Sets config_change_time * - * @param double|null $config_change_time Configuration's last changed time + * @param double|null $config_change_time Last changed time of configuration * * @return $this */ @@ -1442,7 +1442,7 @@ public function setOrdersLimit($orders_limit) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1454,9 +1454,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -1467,7 +1468,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1483,7 +1484,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/DeliverySettlement.php b/src/Model/DeliverySettlement.php index ec537d7..d6d6f30 100644 --- a/src/Model/DeliverySettlement.php +++ b/src/Model/DeliverySettlement.php @@ -42,17 +42,17 @@ class DeliverySettlement implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'DeliverySettlement'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'time' => 'int', 'contract' => 'string', @@ -66,10 +66,10 @@ class DeliverySettlement implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'time' => 'int64', 'contract' => null, @@ -471,7 +471,7 @@ public function setFee($fee) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -483,9 +483,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -496,7 +497,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -512,7 +513,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/DepositAddress.php b/src/Model/DepositAddress.php index 6904aab..12839f5 100644 --- a/src/Model/DepositAddress.php +++ b/src/Model/DepositAddress.php @@ -42,32 +42,32 @@ class DepositAddress implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'DepositAddress'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'address' => 'string', - 'multichain_address' => '\GateApi\Model\MultiChainAddressItem[]' + 'multichain_addresses' => '\GateApi\Model\MultiChainAddressItem[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'address' => null, - 'multichain_address' => null + 'multichain_addresses' => null ]; /** @@ -99,7 +99,7 @@ public static function openAPIFormats() protected static $attributeMap = [ 'currency' => 'currency', 'address' => 'address', - 'multichain_address' => 'multichain_address' + 'multichain_addresses' => 'multichain_addresses' ]; /** @@ -110,7 +110,7 @@ public static function openAPIFormats() protected static $setters = [ 'currency' => 'setCurrency', 'address' => 'setAddress', - 'multichain_address' => 'setMultichainAddress' + 'multichain_addresses' => 'setMultichainAddresses' ]; /** @@ -121,7 +121,7 @@ public static function openAPIFormats() protected static $getters = [ 'currency' => 'getCurrency', 'address' => 'getAddress', - 'multichain_address' => 'getMultichainAddress' + 'multichain_addresses' => 'getMultichainAddresses' ]; /** @@ -186,7 +186,7 @@ public function __construct(array $data = null) { $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; $this->container['address'] = isset($data['address']) ? $data['address'] : null; - $this->container['multichain_address'] = isset($data['multichain_address']) ? $data['multichain_address'] : null; + $this->container['multichain_addresses'] = isset($data['multichain_addresses']) ? $data['multichain_addresses'] : null; } /** @@ -268,25 +268,25 @@ public function setAddress($address) } /** - * Gets multichain_address + * Gets multichain_addresses * * @return \GateApi\Model\MultiChainAddressItem[]|null */ - public function getMultichainAddress() + public function getMultichainAddresses() { - return $this->container['multichain_address']; + return $this->container['multichain_addresses']; } /** - * Sets multichain_address + * Sets multichain_addresses * - * @param \GateApi\Model\MultiChainAddressItem[]|null $multichain_address multichain_address + * @param \GateApi\Model\MultiChainAddressItem[]|null $multichain_addresses multichain_addresses * * @return $this */ - public function setMultichainAddress($multichain_address) + public function setMultichainAddresses($multichain_addresses) { - $this->container['multichain_address'] = $multichain_address; + $this->container['multichain_addresses'] = $multichain_addresses; return $this; } @@ -297,7 +297,7 @@ public function setMultichainAddress($multichain_address) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -309,9 +309,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -322,7 +323,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -338,7 +339,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FlashSwapCurrency.php b/src/Model/FlashSwapCurrency.php new file mode 100644 index 0000000..eab67ec --- /dev/null +++ b/src/Model/FlashSwapCurrency.php @@ -0,0 +1,396 @@ + 'string', + 'min_amount' => 'string', + 'max_amount' => 'string', + 'swappable' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'min_amount' => null, + 'max_amount' => null, + 'swappable' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'swappable' => 'swappable' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'min_amount' => 'setMinAmount', + 'max_amount' => 'setMaxAmount', + 'swappable' => 'setSwappable' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'min_amount' => 'getMinAmount', + 'max_amount' => 'getMaxAmount', + 'swappable' => 'getSwappable' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['min_amount'] = isset($data['min_amount']) ? $data['min_amount'] : null; + $this->container['max_amount'] = isset($data['max_amount']) ? $data['max_amount'] : null; + $this->container['swappable'] = isset($data['swappable']) ? $data['swappable'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency name + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets min_amount + * + * @return string|null + */ + public function getMinAmount() + { + return $this->container['min_amount']; + } + + /** + * Sets min_amount + * + * @param string|null $min_amount Minimum amount required in flash swap + * + * @return $this + */ + public function setMinAmount($min_amount) + { + $this->container['min_amount'] = $min_amount; + + return $this; + } + + /** + * Gets max_amount + * + * @return string|null + */ + public function getMaxAmount() + { + return $this->container['max_amount']; + } + + /** + * Sets max_amount + * + * @param string|null $max_amount Maximum amount allowed in flash swap + * + * @return $this + */ + public function setMaxAmount($max_amount) + { + $this->container['max_amount'] = $max_amount; + + return $this; + } + + /** + * Gets swappable + * + * @return string[]|null + */ + public function getSwappable() + { + return $this->container['swappable']; + } + + /** + * Sets swappable + * + * @param string[]|null $swappable Currencies which can be swapped to from this currency + * + * @return $this + */ + public function setSwappable($swappable) + { + $this->container['swappable'] = $swappable; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FlashSwapOrder.php b/src/Model/FlashSwapOrder.php new file mode 100644 index 0000000..9c292d4 --- /dev/null +++ b/src/Model/FlashSwapOrder.php @@ -0,0 +1,546 @@ + 'int', + 'create_time' => 'int', + 'user_id' => 'int', + 'sell_currency' => 'string', + 'sell_amount' => 'string', + 'buy_currency' => 'string', + 'buy_amount' => 'string', + 'price' => 'string', + 'status' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'create_time' => 'int64', + 'user_id' => 'int64', + 'sell_currency' => null, + 'sell_amount' => null, + 'buy_currency' => null, + 'buy_amount' => null, + 'price' => null, + 'status' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'create_time' => 'create_time', + 'user_id' => 'user_id', + 'sell_currency' => 'sell_currency', + 'sell_amount' => 'sell_amount', + 'buy_currency' => 'buy_currency', + 'buy_amount' => 'buy_amount', + 'price' => 'price', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'create_time' => 'setCreateTime', + 'user_id' => 'setUserId', + 'sell_currency' => 'setSellCurrency', + 'sell_amount' => 'setSellAmount', + 'buy_currency' => 'setBuyCurrency', + 'buy_amount' => 'setBuyAmount', + 'price' => 'setPrice', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'create_time' => 'getCreateTime', + 'user_id' => 'getUserId', + 'sell_currency' => 'getSellCurrency', + 'sell_amount' => 'getSellAmount', + 'buy_currency' => 'getBuyCurrency', + 'buy_amount' => 'getBuyAmount', + 'price' => 'getPrice', + 'status' => 'getStatus' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; + $this->container['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['sell_currency'] = isset($data['sell_currency']) ? $data['sell_currency'] : null; + $this->container['sell_amount'] = isset($data['sell_amount']) ? $data['sell_amount'] : null; + $this->container['buy_currency'] = isset($data['buy_currency']) ? $data['buy_currency'] : null; + $this->container['buy_amount'] = isset($data['buy_amount']) ? $data['buy_amount'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Flash swap order ID + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets create_time + * + * @return int|null + */ + public function getCreateTime() + { + return $this->container['create_time']; + } + + /** + * Sets create_time + * + * @param int|null $create_time Creation time of order (in milliseconds) + * + * @return $this + */ + public function setCreateTime($create_time) + { + $this->container['create_time'] = $create_time; + + return $this; + } + + /** + * Gets user_id + * + * @return int|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param int|null $user_id User ID + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets sell_currency + * + * @return string|null + */ + public function getSellCurrency() + { + return $this->container['sell_currency']; + } + + /** + * Sets sell_currency + * + * @param string|null $sell_currency Currency to sell + * + * @return $this + */ + public function setSellCurrency($sell_currency) + { + $this->container['sell_currency'] = $sell_currency; + + return $this; + } + + /** + * Gets sell_amount + * + * @return string|null + */ + public function getSellAmount() + { + return $this->container['sell_amount']; + } + + /** + * Sets sell_amount + * + * @param string|null $sell_amount Amount to sell + * + * @return $this + */ + public function setSellAmount($sell_amount) + { + $this->container['sell_amount'] = $sell_amount; + + return $this; + } + + /** + * Gets buy_currency + * + * @return string|null + */ + public function getBuyCurrency() + { + return $this->container['buy_currency']; + } + + /** + * Sets buy_currency + * + * @param string|null $buy_currency Currency to buy + * + * @return $this + */ + public function setBuyCurrency($buy_currency) + { + $this->container['buy_currency'] = $buy_currency; + + return $this; + } + + /** + * Gets buy_amount + * + * @return string|null + */ + public function getBuyAmount() + { + return $this->container['buy_amount']; + } + + /** + * Sets buy_amount + * + * @param string|null $buy_amount Amount to buy + * + * @return $this + */ + public function setBuyAmount($buy_amount) + { + $this->container['buy_amount'] = $buy_amount; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Price + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status Flash swap order status `1` - success `2` - failure + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FlashSwapOrderPreview.php b/src/Model/FlashSwapOrderPreview.php new file mode 100644 index 0000000..eb27fbf --- /dev/null +++ b/src/Model/FlashSwapOrderPreview.php @@ -0,0 +1,456 @@ + 'string', + 'sell_currency' => 'string', + 'sell_amount' => 'string', + 'buy_currency' => 'string', + 'buy_amount' => 'string', + 'price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'preview_id' => null, + 'sell_currency' => null, + 'sell_amount' => null, + 'buy_currency' => null, + 'buy_amount' => null, + 'price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'preview_id' => 'preview_id', + 'sell_currency' => 'sell_currency', + 'sell_amount' => 'sell_amount', + 'buy_currency' => 'buy_currency', + 'buy_amount' => 'buy_amount', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'preview_id' => 'setPreviewId', + 'sell_currency' => 'setSellCurrency', + 'sell_amount' => 'setSellAmount', + 'buy_currency' => 'setBuyCurrency', + 'buy_amount' => 'setBuyAmount', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'preview_id' => 'getPreviewId', + 'sell_currency' => 'getSellCurrency', + 'sell_amount' => 'getSellAmount', + 'buy_currency' => 'getBuyCurrency', + 'buy_amount' => 'getBuyAmount', + 'price' => 'getPrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['preview_id'] = isset($data['preview_id']) ? $data['preview_id'] : null; + $this->container['sell_currency'] = isset($data['sell_currency']) ? $data['sell_currency'] : null; + $this->container['sell_amount'] = isset($data['sell_amount']) ? $data['sell_amount'] : null; + $this->container['buy_currency'] = isset($data['buy_currency']) ? $data['buy_currency'] : null; + $this->container['buy_amount'] = isset($data['buy_amount']) ? $data['buy_amount'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 preview_id + * + * @return string|null + */ + public function getPreviewId() + { + return $this->container['preview_id']; + } + + /** + * Sets preview_id + * + * @param string|null $preview_id Preview result ID + * + * @return $this + */ + public function setPreviewId($preview_id) + { + $this->container['preview_id'] = $preview_id; + + return $this; + } + + /** + * Gets sell_currency + * + * @return string|null + */ + public function getSellCurrency() + { + return $this->container['sell_currency']; + } + + /** + * Sets sell_currency + * + * @param string|null $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` + * + * @return $this + */ + public function setSellCurrency($sell_currency) + { + $this->container['sell_currency'] = $sell_currency; + + return $this; + } + + /** + * Gets sell_amount + * + * @return string|null + */ + public function getSellAmount() + { + return $this->container['sell_amount']; + } + + /** + * Sets sell_amount + * + * @param string|null $sell_amount Amount to sell + * + * @return $this + */ + public function setSellAmount($sell_amount) + { + $this->container['sell_amount'] = $sell_amount; + + return $this; + } + + /** + * Gets buy_currency + * + * @return string|null + */ + public function getBuyCurrency() + { + return $this->container['buy_currency']; + } + + /** + * Sets buy_currency + * + * @param string|null $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` + * + * @return $this + */ + public function setBuyCurrency($buy_currency) + { + $this->container['buy_currency'] = $buy_currency; + + return $this; + } + + /** + * Gets buy_amount + * + * @return string|null + */ + public function getBuyAmount() + { + return $this->container['buy_amount']; + } + + /** + * Sets buy_amount + * + * @param string|null $buy_amount Amount to buy + * + * @return $this + */ + public function setBuyAmount($buy_amount) + { + $this->container['buy_amount'] = $buy_amount; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Price + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FlashSwapOrderRequest.php b/src/Model/FlashSwapOrderRequest.php new file mode 100644 index 0000000..5fe3fa0 --- /dev/null +++ b/src/Model/FlashSwapOrderRequest.php @@ -0,0 +1,432 @@ + 'string', + 'sell_currency' => 'string', + 'sell_amount' => 'string', + 'buy_currency' => 'string', + 'buy_amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'preview_id' => null, + 'sell_currency' => null, + 'sell_amount' => null, + 'buy_currency' => null, + 'buy_amount' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'preview_id' => 'preview_id', + 'sell_currency' => 'sell_currency', + 'sell_amount' => 'sell_amount', + 'buy_currency' => 'buy_currency', + 'buy_amount' => 'buy_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'preview_id' => 'setPreviewId', + 'sell_currency' => 'setSellCurrency', + 'sell_amount' => 'setSellAmount', + 'buy_currency' => 'setBuyCurrency', + 'buy_amount' => 'setBuyAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'preview_id' => 'getPreviewId', + 'sell_currency' => 'getSellCurrency', + 'sell_amount' => 'getSellAmount', + 'buy_currency' => 'getBuyCurrency', + 'buy_amount' => 'getBuyAmount' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['preview_id'] = isset($data['preview_id']) ? $data['preview_id'] : null; + $this->container['sell_currency'] = isset($data['sell_currency']) ? $data['sell_currency'] : null; + $this->container['sell_amount'] = isset($data['sell_amount']) ? $data['sell_amount'] : null; + $this->container['buy_currency'] = isset($data['buy_currency']) ? $data['buy_currency'] : null; + $this->container['buy_amount'] = isset($data['buy_amount']) ? $data['buy_amount'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['sell_currency'] === null) { + $invalidProperties[] = "'sell_currency' can't be null"; + } + if ($this->container['buy_currency'] === null) { + $invalidProperties[] = "'buy_currency' 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 preview_id + * + * @return string|null + */ + public function getPreviewId() + { + return $this->container['preview_id']; + } + + /** + * Sets preview_id + * + * @param string|null $preview_id Preview result ID + * + * @return $this + */ + public function setPreviewId($preview_id) + { + $this->container['preview_id'] = $preview_id; + + return $this; + } + + /** + * Gets sell_currency + * + * @return string + */ + public function getSellCurrency() + { + return $this->container['sell_currency']; + } + + /** + * Sets sell_currency + * + * @param string $sell_currency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` + * + * @return $this + */ + public function setSellCurrency($sell_currency) + { + $this->container['sell_currency'] = $sell_currency; + + return $this; + } + + /** + * Gets sell_amount + * + * @return string|null + */ + public function getSellAmount() + { + return $this->container['sell_amount']; + } + + /** + * Sets sell_amount + * + * @param string|null $sell_amount Amount to sell. It is required to choose one parameter between `sell_amount` and `buy_amount` + * + * @return $this + */ + public function setSellAmount($sell_amount) + { + $this->container['sell_amount'] = $sell_amount; + + return $this; + } + + /** + * Gets buy_currency + * + * @return string + */ + public function getBuyCurrency() + { + return $this->container['buy_currency']; + } + + /** + * Sets buy_currency + * + * @param string $buy_currency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` + * + * @return $this + */ + public function setBuyCurrency($buy_currency) + { + $this->container['buy_currency'] = $buy_currency; + + return $this; + } + + /** + * Gets buy_amount + * + * @return string|null + */ + public function getBuyAmount() + { + return $this->container['buy_amount']; + } + + /** + * Sets buy_amount + * + * @param string|null $buy_amount Amount to buy. It is required to choose one parameter between `sell_amount` and `buy_amount` + * + * @return $this + */ + public function setBuyAmount($buy_amount) + { + $this->container['buy_amount'] = $buy_amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FundingAccount.php b/src/Model/FundingAccount.php index dd8cbef..b6aeac4 100644 --- a/src/Model/FundingAccount.php +++ b/src/Model/FundingAccount.php @@ -42,17 +42,17 @@ class FundingAccount implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FundingAccount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'available' => 'string', @@ -62,10 +62,10 @@ class FundingAccount implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'available' => null, @@ -310,7 +310,7 @@ public function getLent() /** * Sets lent * - * @param string|null $lent Amount that is loaned but not repaid + * @param string|null $lent Outstanding loan amount yet to be repaid * * @return $this */ @@ -351,7 +351,7 @@ public function setTotalLent($total_lent) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -363,9 +363,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -376,7 +377,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -392,7 +393,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FundingBookItem.php b/src/Model/FundingBookItem.php index 5b4a7ac..0ccb2d7 100644 --- a/src/Model/FundingBookItem.php +++ b/src/Model/FundingBookItem.php @@ -42,17 +42,17 @@ class FundingBookItem implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FundingBookItem'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rate' => 'string', 'amount' => 'string', @@ -60,10 +60,10 @@ class FundingBookItem implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'rate' => null, 'amount' => null, @@ -226,7 +226,7 @@ public function getRate() /** * Sets rate * - * @param string|null $rate Loan rate + * @param string|null $rate Loan rate (daily rate) * * @return $this */ @@ -274,7 +274,7 @@ public function getDays() /** * Sets days * - * @param int|null $days How long the loan should be repaid + * @param int|null $days The number of days till the loan repayment's dateline * * @return $this */ @@ -291,7 +291,7 @@ public function setDays($days) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -303,9 +303,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -316,7 +317,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -332,7 +333,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FundingRateRecord.php b/src/Model/FundingRateRecord.php index 728d189..5a3af72 100644 --- a/src/Model/FundingRateRecord.php +++ b/src/Model/FundingRateRecord.php @@ -42,27 +42,27 @@ class FundingRateRecord implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FundingRateRecord'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 't' => 'int', 'r' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 't' => 'int64', 'r' => null @@ -261,7 +261,7 @@ public function setR($r) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -273,9 +273,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -286,7 +287,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -302,7 +303,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesAccount.php b/src/Model/FuturesAccount.php index 2ce1604..9e172d9 100644 --- a/src/Model/FuturesAccount.php +++ b/src/Model/FuturesAccount.php @@ -42,17 +42,17 @@ class FuturesAccount implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesAccount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'total' => 'string', 'unrealised_pnl' => 'string', @@ -61,14 +61,19 @@ class FuturesAccount implements ModelInterface, ArrayAccess 'available' => 'string', 'point' => 'string', 'currency' => 'string', - 'in_dual_mode' => 'bool' + 'in_dual_mode' => 'bool', + 'enable_credit' => 'bool', + 'position_initial_margin' => 'string', + 'maintenance_margin' => 'string', + 'bonus' => 'string', + 'history' => '\GateApi\Model\FuturesAccountHistory' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'total' => null, 'unrealised_pnl' => null, @@ -77,7 +82,12 @@ class FuturesAccount implements ModelInterface, ArrayAccess 'available' => null, 'point' => null, 'currency' => null, - 'in_dual_mode' => null + 'in_dual_mode' => null, + 'enable_credit' => null, + 'position_initial_margin' => null, + 'maintenance_margin' => null, + 'bonus' => null, + 'history' => null ]; /** @@ -114,7 +124,12 @@ public static function openAPIFormats() 'available' => 'available', 'point' => 'point', 'currency' => 'currency', - 'in_dual_mode' => 'in_dual_mode' + 'in_dual_mode' => 'in_dual_mode', + 'enable_credit' => 'enable_credit', + 'position_initial_margin' => 'position_initial_margin', + 'maintenance_margin' => 'maintenance_margin', + 'bonus' => 'bonus', + 'history' => 'history' ]; /** @@ -130,7 +145,12 @@ public static function openAPIFormats() 'available' => 'setAvailable', 'point' => 'setPoint', 'currency' => 'setCurrency', - 'in_dual_mode' => 'setInDualMode' + 'in_dual_mode' => 'setInDualMode', + 'enable_credit' => 'setEnableCredit', + 'position_initial_margin' => 'setPositionInitialMargin', + 'maintenance_margin' => 'setMaintenanceMargin', + 'bonus' => 'setBonus', + 'history' => 'setHistory' ]; /** @@ -146,7 +166,12 @@ public static function openAPIFormats() 'available' => 'getAvailable', 'point' => 'getPoint', 'currency' => 'getCurrency', - 'in_dual_mode' => 'getInDualMode' + 'in_dual_mode' => 'getInDualMode', + 'enable_credit' => 'getEnableCredit', + 'position_initial_margin' => 'getPositionInitialMargin', + 'maintenance_margin' => 'getMaintenanceMargin', + 'bonus' => 'getBonus', + 'history' => 'getHistory' ]; /** @@ -217,6 +242,11 @@ public function __construct(array $data = null) $this->container['point'] = isset($data['point']) ? $data['point'] : null; $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; $this->container['in_dual_mode'] = isset($data['in_dual_mode']) ? $data['in_dual_mode'] : null; + $this->container['enable_credit'] = isset($data['enable_credit']) ? $data['enable_credit'] : null; + $this->container['position_initial_margin'] = isset($data['position_initial_margin']) ? $data['position_initial_margin'] : null; + $this->container['maintenance_margin'] = isset($data['maintenance_margin']) ? $data['maintenance_margin'] : null; + $this->container['bonus'] = isset($data['bonus']) ? $data['bonus'] : null; + $this->container['history'] = isset($data['history']) ? $data['history'] : null; } /** @@ -256,7 +286,7 @@ public function getTotal() /** * Sets total * - * @param string|null $total Total assets, total = position_margin + order_margin + available + * @param string|null $total total is the balance after the user's accumulated deposit, withdraw, profit and loss (including realized profit and loss, fund, fee and referral rebate), excluding unrealized profit and loss. total = SUM(history_dnw, history_pnl, history_fee, history_refr, history_fund) * * @return $this */ @@ -352,7 +382,7 @@ public function getAvailable() /** * Sets available * - * @param string|null $available Available balance to transfer out or trade + * @param string|null $available The available balance for transferring or trading(including bonus. Bonus can't be be withdrawn. The transfer amount needs to deduct the bonus) * * @return $this */ @@ -434,6 +464,126 @@ public function setInDualMode($in_dual_mode) return $this; } + + /** + * Gets enable_credit + * + * @return bool|null + */ + public function getEnableCredit() + { + return $this->container['enable_credit']; + } + + /** + * Sets enable_credit + * + * @param bool|null $enable_credit Whether portfolio margin account mode is enabled + * + * @return $this + */ + public function setEnableCredit($enable_credit) + { + $this->container['enable_credit'] = $enable_credit; + + return $this; + } + + /** + * Gets position_initial_margin + * + * @return string|null + */ + public function getPositionInitialMargin() + { + return $this->container['position_initial_margin']; + } + + /** + * Sets position_initial_margin + * + * @param string|null $position_initial_margin Initial margin position, applicable to the portfolio margin account model + * + * @return $this + */ + public function setPositionInitialMargin($position_initial_margin) + { + $this->container['position_initial_margin'] = $position_initial_margin; + + return $this; + } + + /** + * Gets maintenance_margin + * + * @return string|null + */ + public function getMaintenanceMargin() + { + return $this->container['maintenance_margin']; + } + + /** + * Sets maintenance_margin + * + * @param string|null $maintenance_margin Maintenance margin position, applicable to the portfolio margin account model + * + * @return $this + */ + public function setMaintenanceMargin($maintenance_margin) + { + $this->container['maintenance_margin'] = $maintenance_margin; + + return $this; + } + + /** + * Gets bonus + * + * @return string|null + */ + public function getBonus() + { + return $this->container['bonus']; + } + + /** + * Sets bonus + * + * @param string|null $bonus Perpetual Contract Bonus + * + * @return $this + */ + public function setBonus($bonus) + { + $this->container['bonus'] = $bonus; + + return $this; + } + + /** + * Gets history + * + * @return \GateApi\Model\FuturesAccountHistory|null + */ + public function getHistory() + { + return $this->container['history']; + } + + /** + * Sets history + * + * @param \GateApi\Model\FuturesAccountHistory|null $history history + * + * @return $this + */ + public function setHistory($history) + { + $this->container['history'] = $history; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -441,7 +591,7 @@ public function setInDualMode($in_dual_mode) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -453,9 +603,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -466,7 +617,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -482,7 +633,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesAccountBook.php b/src/Model/FuturesAccountBook.php index be2f976..3e52f58 100644 --- a/src/Model/FuturesAccountBook.php +++ b/src/Model/FuturesAccountBook.php @@ -42,17 +42,17 @@ class FuturesAccountBook implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesAccountBook'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'time' => 'double', 'change' => 'string', @@ -62,10 +62,10 @@ class FuturesAccountBook implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'time' => 'double', 'change' => null, @@ -395,7 +395,7 @@ public function setText($text) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -407,9 +407,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -420,7 +421,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -436,7 +437,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesAccountHistory.php b/src/Model/FuturesAccountHistory.php new file mode 100644 index 0000000..9cd2d06 --- /dev/null +++ b/src/Model/FuturesAccountHistory.php @@ -0,0 +1,576 @@ + 'string', + 'pnl' => 'string', + 'fee' => 'string', + 'refr' => 'string', + 'fund' => 'string', + 'point_dnw' => 'string', + 'point_fee' => 'string', + 'point_refr' => 'string', + 'bonus_dnw' => 'string', + 'bonus_offset' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'dnw' => null, + 'pnl' => null, + 'fee' => null, + 'refr' => null, + 'fund' => null, + 'point_dnw' => null, + 'point_fee' => null, + 'point_refr' => null, + 'bonus_dnw' => null, + 'bonus_offset' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'dnw' => 'dnw', + 'pnl' => 'pnl', + 'fee' => 'fee', + 'refr' => 'refr', + 'fund' => 'fund', + 'point_dnw' => 'point_dnw', + 'point_fee' => 'point_fee', + 'point_refr' => 'point_refr', + 'bonus_dnw' => 'bonus_dnw', + 'bonus_offset' => 'bonus_offset' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'dnw' => 'setDnw', + 'pnl' => 'setPnl', + 'fee' => 'setFee', + 'refr' => 'setRefr', + 'fund' => 'setFund', + 'point_dnw' => 'setPointDnw', + 'point_fee' => 'setPointFee', + 'point_refr' => 'setPointRefr', + 'bonus_dnw' => 'setBonusDnw', + 'bonus_offset' => 'setBonusOffset' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'dnw' => 'getDnw', + 'pnl' => 'getPnl', + 'fee' => 'getFee', + 'refr' => 'getRefr', + 'fund' => 'getFund', + 'point_dnw' => 'getPointDnw', + 'point_fee' => 'getPointFee', + 'point_refr' => 'getPointRefr', + 'bonus_dnw' => 'getBonusDnw', + 'bonus_offset' => 'getBonusOffset' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['dnw'] = isset($data['dnw']) ? $data['dnw'] : null; + $this->container['pnl'] = isset($data['pnl']) ? $data['pnl'] : null; + $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; + $this->container['refr'] = isset($data['refr']) ? $data['refr'] : null; + $this->container['fund'] = isset($data['fund']) ? $data['fund'] : null; + $this->container['point_dnw'] = isset($data['point_dnw']) ? $data['point_dnw'] : null; + $this->container['point_fee'] = isset($data['point_fee']) ? $data['point_fee'] : null; + $this->container['point_refr'] = isset($data['point_refr']) ? $data['point_refr'] : null; + $this->container['bonus_dnw'] = isset($data['bonus_dnw']) ? $data['bonus_dnw'] : null; + $this->container['bonus_offset'] = isset($data['bonus_offset']) ? $data['bonus_offset'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 dnw + * + * @return string|null + */ + public function getDnw() + { + return $this->container['dnw']; + } + + /** + * Sets dnw + * + * @param string|null $dnw total amount of deposit and withdraw + * + * @return $this + */ + public function setDnw($dnw) + { + $this->container['dnw'] = $dnw; + + return $this; + } + + /** + * Gets pnl + * + * @return string|null + */ + public function getPnl() + { + return $this->container['pnl']; + } + + /** + * Sets pnl + * + * @param string|null $pnl total amount of trading profit and loss + * + * @return $this + */ + public function setPnl($pnl) + { + $this->container['pnl'] = $pnl; + + return $this; + } + + /** + * Gets fee + * + * @return string|null + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param string|null $fee total amount of fee + * + * @return $this + */ + public function setFee($fee) + { + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets refr + * + * @return string|null + */ + public function getRefr() + { + return $this->container['refr']; + } + + /** + * Sets refr + * + * @param string|null $refr total amount of referrer rebates + * + * @return $this + */ + public function setRefr($refr) + { + $this->container['refr'] = $refr; + + return $this; + } + + /** + * Gets fund + * + * @return string|null + */ + public function getFund() + { + return $this->container['fund']; + } + + /** + * Sets fund + * + * @param string|null $fund total amount of funding costs + * + * @return $this + */ + public function setFund($fund) + { + $this->container['fund'] = $fund; + + return $this; + } + + /** + * Gets point_dnw + * + * @return string|null + */ + public function getPointDnw() + { + return $this->container['point_dnw']; + } + + /** + * Sets point_dnw + * + * @param string|null $point_dnw total amount of point deposit and withdraw + * + * @return $this + */ + public function setPointDnw($point_dnw) + { + $this->container['point_dnw'] = $point_dnw; + + return $this; + } + + /** + * Gets point_fee + * + * @return string|null + */ + public function getPointFee() + { + return $this->container['point_fee']; + } + + /** + * Sets point_fee + * + * @param string|null $point_fee total amount of point fee + * + * @return $this + */ + public function setPointFee($point_fee) + { + $this->container['point_fee'] = $point_fee; + + return $this; + } + + /** + * Gets point_refr + * + * @return string|null + */ + public function getPointRefr() + { + return $this->container['point_refr']; + } + + /** + * Sets point_refr + * + * @param string|null $point_refr total amount of referrer rebates of point fee + * + * @return $this + */ + public function setPointRefr($point_refr) + { + $this->container['point_refr'] = $point_refr; + + return $this; + } + + /** + * Gets bonus_dnw + * + * @return string|null + */ + public function getBonusDnw() + { + return $this->container['bonus_dnw']; + } + + /** + * Sets bonus_dnw + * + * @param string|null $bonus_dnw total amount of perpetual contract bonus transfer + * + * @return $this + */ + public function setBonusDnw($bonus_dnw) + { + $this->container['bonus_dnw'] = $bonus_dnw; + + return $this; + } + + /** + * Gets bonus_offset + * + * @return string|null + */ + public function getBonusOffset() + { + return $this->container['bonus_offset']; + } + + /** + * Sets bonus_offset + * + * @param string|null $bonus_offset total amount of perpetual contract bonus deduction + * + * @return $this + */ + public function setBonusOffset($bonus_offset) + { + $this->container['bonus_offset'] = $bonus_offset; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FuturesAutoDeleverage.php b/src/Model/FuturesAutoDeleverage.php new file mode 100644 index 0000000..86ce12e --- /dev/null +++ b/src/Model/FuturesAutoDeleverage.php @@ -0,0 +1,575 @@ + 'int', + 'user' => 'int', + 'order_id' => 'int', + 'contract' => 'string', + 'leverage' => 'string', + 'cross_leverage_limit' => 'string', + 'entry_price' => 'string', + 'fill_price' => 'string', + 'trade_size' => 'int', + 'position_size' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'time' => 'int64', + 'user' => 'int64', + 'order_id' => 'int64', + 'contract' => null, + 'leverage' => null, + 'cross_leverage_limit' => null, + 'entry_price' => null, + 'fill_price' => null, + 'trade_size' => 'int64', + 'position_size' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time' => 'time', + 'user' => 'user', + 'order_id' => 'order_id', + 'contract' => 'contract', + 'leverage' => 'leverage', + 'cross_leverage_limit' => 'cross_leverage_limit', + 'entry_price' => 'entry_price', + 'fill_price' => 'fill_price', + 'trade_size' => 'trade_size', + 'position_size' => 'position_size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time' => 'setTime', + 'user' => 'setUser', + 'order_id' => 'setOrderId', + 'contract' => 'setContract', + 'leverage' => 'setLeverage', + 'cross_leverage_limit' => 'setCrossLeverageLimit', + 'entry_price' => 'setEntryPrice', + 'fill_price' => 'setFillPrice', + 'trade_size' => 'setTradeSize', + 'position_size' => 'setPositionSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time' => 'getTime', + 'user' => 'getUser', + 'order_id' => 'getOrderId', + 'contract' => 'getContract', + 'leverage' => 'getLeverage', + 'cross_leverage_limit' => 'getCrossLeverageLimit', + 'entry_price' => 'getEntryPrice', + 'fill_price' => 'getFillPrice', + 'trade_size' => 'getTradeSize', + 'position_size' => 'getPositionSize' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['user'] = isset($data['user']) ? $data['user'] : null; + $this->container['order_id'] = isset($data['order_id']) ? $data['order_id'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['leverage'] = isset($data['leverage']) ? $data['leverage'] : null; + $this->container['cross_leverage_limit'] = isset($data['cross_leverage_limit']) ? $data['cross_leverage_limit'] : null; + $this->container['entry_price'] = isset($data['entry_price']) ? $data['entry_price'] : null; + $this->container['fill_price'] = isset($data['fill_price']) ? $data['fill_price'] : null; + $this->container['trade_size'] = isset($data['trade_size']) ? $data['trade_size'] : null; + $this->container['position_size'] = isset($data['position_size']) ? $data['position_size'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 time + * + * @return int|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param int|null $time Automatic deleveraging time + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets user + * + * @return int|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param int|null $user User ID + * + * @return $this + */ + public function setUser($user) + { + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets order_id + * + * @return int|null + */ + public function getOrderId() + { + return $this->container['order_id']; + } + + /** + * Sets order_id + * + * @param int|null $order_id Order ID. Order IDs before 2023-02-20 are null + * + * @return $this + */ + public function setOrderId($order_id) + { + $this->container['order_id'] = $order_id; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Futures contract + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets leverage + * + * @return string|null + */ + public function getLeverage() + { + return $this->container['leverage']; + } + + /** + * Sets leverage + * + * @param string|null $leverage Position leverage + * + * @return $this + */ + public function setLeverage($leverage) + { + $this->container['leverage'] = $leverage; + + return $this; + } + + /** + * Gets cross_leverage_limit + * + * @return string|null + */ + public function getCrossLeverageLimit() + { + return $this->container['cross_leverage_limit']; + } + + /** + * Sets cross_leverage_limit + * + * @param string|null $cross_leverage_limit Cross margin leverage(valid only when `leverage` is 0) + * + * @return $this + */ + public function setCrossLeverageLimit($cross_leverage_limit) + { + $this->container['cross_leverage_limit'] = $cross_leverage_limit; + + return $this; + } + + /** + * Gets entry_price + * + * @return string|null + */ + public function getEntryPrice() + { + return $this->container['entry_price']; + } + + /** + * Sets entry_price + * + * @param string|null $entry_price Average entry price + * + * @return $this + */ + public function setEntryPrice($entry_price) + { + $this->container['entry_price'] = $entry_price; + + return $this; + } + + /** + * Gets fill_price + * + * @return string|null + */ + public function getFillPrice() + { + return $this->container['fill_price']; + } + + /** + * Sets fill_price + * + * @param string|null $fill_price Average fill price + * + * @return $this + */ + public function setFillPrice($fill_price) + { + $this->container['fill_price'] = $fill_price; + + return $this; + } + + /** + * Gets trade_size + * + * @return int|null + */ + public function getTradeSize() + { + return $this->container['trade_size']; + } + + /** + * Sets trade_size + * + * @param int|null $trade_size Trading size + * + * @return $this + */ + public function setTradeSize($trade_size) + { + $this->container['trade_size'] = $trade_size; + + return $this; + } + + /** + * Gets position_size + * + * @return int|null + */ + public function getPositionSize() + { + return $this->container['position_size']; + } + + /** + * Sets position_size + * + * @param int|null $position_size Positions after auto-deleveraging + * + * @return $this + */ + public function setPositionSize($position_size) + { + $this->container['position_size'] = $position_size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FuturesCandlestick.php b/src/Model/FuturesCandlestick.php index 748bcba..4482be3 100644 --- a/src/Model/FuturesCandlestick.php +++ b/src/Model/FuturesCandlestick.php @@ -43,38 +43,40 @@ class FuturesCandlestick implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesCandlestick'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 't' => 'double', 'v' => 'int', 'c' => 'string', 'h' => 'string', 'l' => 'string', - 'o' => 'string' + 'o' => 'string', + 'sum' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 't' => 'double', 'v' => 'int64', 'c' => null, 'h' => null, 'l' => null, - 'o' => null + 'o' => null, + 'sum' => null ]; /** @@ -109,7 +111,8 @@ public static function openAPIFormats() 'c' => 'c', 'h' => 'h', 'l' => 'l', - 'o' => 'o' + 'o' => 'o', + 'sum' => 'sum' ]; /** @@ -123,7 +126,8 @@ public static function openAPIFormats() 'c' => 'setC', 'h' => 'setH', 'l' => 'setL', - 'o' => 'setO' + 'o' => 'setO', + 'sum' => 'setSum' ]; /** @@ -137,7 +141,8 @@ public static function openAPIFormats() 'c' => 'getC', 'h' => 'getH', 'l' => 'getL', - 'o' => 'getO' + 'o' => 'getO', + 'sum' => 'getSum' ]; /** @@ -206,6 +211,7 @@ public function __construct(array $data = null) $this->container['h'] = isset($data['h']) ? $data['h'] : null; $this->container['l'] = isset($data['l']) ? $data['l'] : null; $this->container['o'] = isset($data['o']) ? $data['o'] : null; + $this->container['sum'] = isset($data['sum']) ? $data['sum'] : null; } /** @@ -269,7 +275,7 @@ public function getV() /** * Sets v * - * @param int|null $v size volume. Only returned if `contract` is not prefixed + * @param int|null $v size volume (contract size). Only returned if `contract` is not prefixed * * @return $this */ @@ -293,7 +299,7 @@ public function getC() /** * Sets c * - * @param string|null $c Close price + * @param string|null $c Close price (quote currency) * * @return $this */ @@ -317,7 +323,7 @@ public function getH() /** * Sets h * - * @param string|null $h Highest price + * @param string|null $h Highest price (quote currency) * * @return $this */ @@ -341,7 +347,7 @@ public function getL() /** * Sets l * - * @param string|null $l Lowest price + * @param string|null $l Lowest price (quote currency) * * @return $this */ @@ -365,7 +371,7 @@ public function getO() /** * Sets o * - * @param string|null $o Open price + * @param string|null $o Open price (quote currency) * * @return $this */ @@ -375,6 +381,30 @@ public function setO($o) return $this; } + + /** + * Gets sum + * + * @return string|null + */ + public function getSum() + { + return $this->container['sum']; + } + + /** + * Sets sum + * + * @param string|null $sum Trading volume (unit: Quote currency) + * + * @return $this + */ + public function setSum($sum) + { + $this->container['sum'] = $sum; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -382,7 +412,7 @@ public function setO($o) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,9 +424,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -407,7 +438,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -423,7 +454,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesIndexConstituents.php b/src/Model/FuturesIndexConstituents.php new file mode 100644 index 0000000..89e7960 --- /dev/null +++ b/src/Model/FuturesIndexConstituents.php @@ -0,0 +1,335 @@ + 'string', + 'constituents' => '\GateApi\Model\IndexConstituent[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'index' => null, + 'constituents' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'index' => 'index', + 'constituents' => 'constituents' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'index' => 'setIndex', + 'constituents' => 'setConstituents' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'index' => 'getIndex', + 'constituents' => 'getConstituents' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['index'] = isset($data['index']) ? $data['index'] : null; + $this->container['constituents'] = isset($data['constituents']) ? $data['constituents'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 index + * + * @return string|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string|null $index Index name + * + * @return $this + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets constituents + * + * @return \GateApi\Model\IndexConstituent[]|null + */ + public function getConstituents() + { + return $this->container['constituents']; + } + + /** + * Sets constituents + * + * @param \GateApi\Model\IndexConstituent[]|null $constituents Constituents + * + * @return $this + */ + public function setConstituents($constituents) + { + $this->container['constituents'] = $constituents; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FuturesInitialOrder.php b/src/Model/FuturesInitialOrder.php index b358370..4b9d6e8 100644 --- a/src/Model/FuturesInitialOrder.php +++ b/src/Model/FuturesInitialOrder.php @@ -42,17 +42,17 @@ class FuturesInitialOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesInitialOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'contract' => 'string', 'size' => 'int', @@ -61,15 +61,16 @@ class FuturesInitialOrder implements ModelInterface, ArrayAccess 'tif' => 'string', 'text' => 'string', 'reduce_only' => 'bool', + 'auto_size' => 'string', 'is_reduce_only' => 'bool', 'is_close' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'contract' => null, 'size' => 'int64', @@ -78,6 +79,7 @@ class FuturesInitialOrder implements ModelInterface, ArrayAccess 'tif' => null, 'text' => null, 'reduce_only' => null, + 'auto_size' => null, 'is_reduce_only' => null, 'is_close' => null ]; @@ -116,6 +118,7 @@ public static function openAPIFormats() 'tif' => 'tif', 'text' => 'text', 'reduce_only' => 'reduce_only', + 'auto_size' => 'auto_size', 'is_reduce_only' => 'is_reduce_only', 'is_close' => 'is_close' ]; @@ -133,6 +136,7 @@ public static function openAPIFormats() 'tif' => 'setTif', 'text' => 'setText', 'reduce_only' => 'setReduceOnly', + 'auto_size' => 'setAutoSize', 'is_reduce_only' => 'setIsReduceOnly', 'is_close' => 'setIsClose' ]; @@ -150,6 +154,7 @@ public static function openAPIFormats() 'tif' => 'getTif', 'text' => 'getText', 'reduce_only' => 'getReduceOnly', + 'auto_size' => 'getAutoSize', 'is_reduce_only' => 'getIsReduceOnly', 'is_close' => 'getIsClose' ]; @@ -236,6 +241,7 @@ public function __construct(array $data = null) $this->container['tif'] = isset($data['tif']) ? $data['tif'] : 'gtc'; $this->container['text'] = isset($data['text']) ? $data['text'] : null; $this->container['reduce_only'] = isset($data['reduce_only']) ? $data['reduce_only'] : false; + $this->container['auto_size'] = isset($data['auto_size']) ? $data['auto_size'] : null; $this->container['is_reduce_only'] = isset($data['is_reduce_only']) ? $data['is_reduce_only'] : null; $this->container['is_close'] = isset($data['is_close']) ? $data['is_close'] : null; } @@ -444,7 +450,7 @@ public function getReduceOnly() /** * Sets reduce_only * - * @param bool|null $reduce_only Set to true to create an reduce-only order + * @param bool|null $reduce_only Set to true to create a reduce-only order * * @return $this */ @@ -455,6 +461,30 @@ public function setReduceOnly($reduce_only) return $this; } + /** + * Gets auto_size + * + * @return string|null + */ + public function getAutoSize() + { + return $this->container['auto_size']; + } + + /** + * Sets auto_size + * + * @param string|null $auto_size Set side to close dual-mode position. `close_long` closes the long side; while `close_short` the short one. Note `size` also needs to be set to 0 + * + * @return $this + */ + public function setAutoSize($auto_size) + { + $this->container['auto_size'] = $auto_size; + + return $this; + } + /** * Gets is_reduce_only * @@ -509,7 +539,7 @@ public function setIsClose($is_close) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -521,9 +551,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -534,7 +565,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -550,7 +581,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesLiquidate.php b/src/Model/FuturesLiquidate.php index 112c2b7..db5b782 100644 --- a/src/Model/FuturesLiquidate.php +++ b/src/Model/FuturesLiquidate.php @@ -42,17 +42,17 @@ class FuturesLiquidate implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesLiquidate'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'time' => 'int', 'contract' => 'string', @@ -69,10 +69,10 @@ class FuturesLiquidate implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'time' => 'int64', 'contract' => null, @@ -561,7 +561,7 @@ public function setLeft($left) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -573,9 +573,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -586,7 +587,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -602,7 +603,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesOrder.php b/src/Model/FuturesOrder.php index f27b29a..442a004 100644 --- a/src/Model/FuturesOrder.php +++ b/src/Model/FuturesOrder.php @@ -43,17 +43,17 @@ class FuturesOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'user' => 'int', @@ -76,14 +76,15 @@ class FuturesOrder implements ModelInterface, ArrayAccess 'text' => 'string', 'tkfr' => 'string', 'mkfr' => 'string', - 'refu' => 'int' + 'refu' => 'int', + 'auto_size' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64', 'user' => null, @@ -106,7 +107,8 @@ class FuturesOrder implements ModelInterface, ArrayAccess 'text' => null, 'tkfr' => null, 'mkfr' => null, - 'refu' => null + 'refu' => null, + 'auto_size' => null ]; /** @@ -157,7 +159,8 @@ public static function openAPIFormats() 'text' => 'text', 'tkfr' => 'tkfr', 'mkfr' => 'mkfr', - 'refu' => 'refu' + 'refu' => 'refu', + 'auto_size' => 'auto_size' ]; /** @@ -187,7 +190,8 @@ public static function openAPIFormats() 'text' => 'setText', 'tkfr' => 'setTkfr', 'mkfr' => 'setMkfr', - 'refu' => 'setRefu' + 'refu' => 'setRefu', + 'auto_size' => 'setAutoSize' ]; /** @@ -217,7 +221,8 @@ public static function openAPIFormats() 'text' => 'getText', 'tkfr' => 'getTkfr', 'mkfr' => 'getMkfr', - 'refu' => 'getRefu' + 'refu' => 'getRefu', + 'auto_size' => 'getAutoSize' ]; /** @@ -274,6 +279,9 @@ public function getModelName() const TIF_GTC = 'gtc'; const TIF_IOC = 'ioc'; const TIF_POC = 'poc'; + const TIF_FOK = 'fok'; + const AUTO_SIZE_LONG = 'close_long'; + const AUTO_SIZE_SHORT = 'close_short'; @@ -320,6 +328,20 @@ public function getTifAllowableValues() self::TIF_GTC, self::TIF_IOC, self::TIF_POC, + self::TIF_FOK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAutoSizeAllowableValues() + { + return [ + self::AUTO_SIZE_LONG, + self::AUTO_SIZE_SHORT, ]; } @@ -361,6 +383,7 @@ public function __construct(array $data = null) $this->container['tkfr'] = isset($data['tkfr']) ? $data['tkfr'] : null; $this->container['mkfr'] = isset($data['mkfr']) ? $data['mkfr'] : null; $this->container['refu'] = isset($data['refu']) ? $data['refu'] : null; + $this->container['auto_size'] = isset($data['auto_size']) ? $data['auto_size'] : null; } /** @@ -402,6 +425,14 @@ public function listInvalidProperties() ); } + $allowedValues = $this->getAutoSizeAllowableValues(); + if (!is_null($this->container['auto_size']) && !in_array($this->container['auto_size'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'auto_size', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -478,7 +509,7 @@ public function getCreateTime() /** * Sets create_time * - * @param double|null $create_time Order creation time + * @param double|null $create_time Creation time of order * * @return $this */ @@ -526,7 +557,7 @@ public function getFinishAs() /** * Sets finish_as * - * @param string|null $finish_as How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close + * @param string|null $finish_as How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close * * @return $this */ @@ -640,7 +671,7 @@ public function getIceberg() /** * Sets iceberg * - * @param int|null $iceberg Display size for iceberg order. 0 for non-iceberg. Note that you would pay the taker fee for the hidden size + * @param int|null $iceberg Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size * * @return $this */ @@ -808,7 +839,7 @@ public function getTif() /** * Sets tif * - * @param string|null $tif Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, reduce-only + * @param string|null $tif Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none * * @return $this */ @@ -971,6 +1002,39 @@ public function setRefu($refu) return $this; } + + /** + * Gets auto_size + * + * @return string|null + */ + public function getAutoSize() + { + return $this->container['auto_size']; + } + + /** + * Sets auto_size + * + * @param string|null $auto_size Set side to close dual-mode position. `close_long` closes the long side; while `close_short` the short one. Note `size` also needs to be set to 0 + * + * @return $this + */ + public function setAutoSize($auto_size) + { + $allowedValues = $this->getAutoSizeAllowableValues(); + if (!is_null($auto_size) && !in_array($auto_size, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'auto_size', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['auto_size'] = $auto_size; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -978,7 +1042,7 @@ public function setRefu($refu) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -990,9 +1054,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -1003,7 +1068,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1019,7 +1084,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesOrderAmendment.php b/src/Model/FuturesOrderAmendment.php new file mode 100644 index 0000000..d98772d --- /dev/null +++ b/src/Model/FuturesOrderAmendment.php @@ -0,0 +1,335 @@ + 'int', + 'price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'size' => 'int64', + 'price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'size' => 'size', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'size' => 'setSize', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'size' => 'getSize', + 'price' => 'getPrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['size'] = isset($data['size']) ? $data['size'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size New order size, including filled part. - If new size is less than or equal to filled size, the order will be cancelled. - Order side must be identical to the original one. - Close order size cannot be changed. - For reduce only orders, increasing size may leads to other reduce only orders being cancelled. - If price is not changed, decreasing size will not change its precedence in order book, while increasing will move it to the last at current price. + * + * @return $this + */ + public function setSize($size) + { + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price New order price. + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FuturesOrderBook.php b/src/Model/FuturesOrderBook.php index fefc166..74a436d 100644 --- a/src/Model/FuturesOrderBook.php +++ b/src/Model/FuturesOrderBook.php @@ -42,30 +42,34 @@ class FuturesOrderBook implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesOrderBook'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', + 'current' => 'double', + 'update' => 'double', 'asks' => '\GateApi\Model\FuturesOrderBookItem[]', 'bids' => '\GateApi\Model\FuturesOrderBookItem[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64', + 'current' => 'double', + 'update' => 'double', 'asks' => null, 'bids' => null ]; @@ -98,6 +102,8 @@ public static function openAPIFormats() */ protected static $attributeMap = [ 'id' => 'id', + 'current' => 'current', + 'update' => 'update', 'asks' => 'asks', 'bids' => 'bids' ]; @@ -109,6 +115,8 @@ public static function openAPIFormats() */ protected static $setters = [ 'id' => 'setId', + 'current' => 'setCurrent', + 'update' => 'setUpdate', 'asks' => 'setAsks', 'bids' => 'setBids' ]; @@ -120,6 +128,8 @@ public static function openAPIFormats() */ protected static $getters = [ 'id' => 'getId', + 'current' => 'getCurrent', + 'update' => 'getUpdate', 'asks' => 'getAsks', 'bids' => 'getBids' ]; @@ -185,6 +195,8 @@ public function getModelName() public function __construct(array $data = null) { $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['current'] = isset($data['current']) ? $data['current'] : null; + $this->container['update'] = isset($data['update']) ? $data['update'] : null; $this->container['asks'] = isset($data['asks']) ? $data['asks'] : null; $this->container['bids'] = isset($data['bids']) ? $data['bids'] : null; } @@ -232,7 +244,7 @@ public function getId() /** * Sets id * - * @param int|null $id Order Book ID. Increase by 1 on every order book change. Set `with_id=true` to include this field in response + * @param int|null $id Order Book ID. Increases by 1 on every order book change. Set `with_id=true` to include this field in response * * @return $this */ @@ -243,6 +255,54 @@ public function setId($id) return $this; } + /** + * Gets current + * + * @return double|null + */ + public function getCurrent() + { + return $this->container['current']; + } + + /** + * Sets current + * + * @param double|null $current Response data generation timestamp + * + * @return $this + */ + public function setCurrent($current) + { + $this->container['current'] = $current; + + return $this; + } + + /** + * Gets update + * + * @return double|null + */ + public function getUpdate() + { + return $this->container['update']; + } + + /** + * Sets update + * + * @param double|null $update Order book changed timestamp + * + * @return $this + */ + public function setUpdate($update) + { + $this->container['update'] = $update; + + return $this; + } + /** * Gets asks * @@ -297,7 +357,7 @@ public function setBids($bids) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -309,9 +369,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -322,7 +383,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -338,7 +399,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesOrderBookItem.php b/src/Model/FuturesOrderBookItem.php index 8e775b7..18ee2a3 100644 --- a/src/Model/FuturesOrderBookItem.php +++ b/src/Model/FuturesOrderBookItem.php @@ -42,27 +42,27 @@ class FuturesOrderBookItem implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'futures_order_book_item'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'p' => 'string', 's' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'p' => null, 's' => 'int64' @@ -220,7 +220,7 @@ public function getP() /** * Sets p * - * @param string|null $p Price + * @param string|null $p Price (quote currency) * * @return $this */ @@ -261,7 +261,7 @@ public function setS($s) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -273,9 +273,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -286,7 +287,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -302,7 +303,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesPremiumIndex.php b/src/Model/FuturesPremiumIndex.php new file mode 100644 index 0000000..4c1724f --- /dev/null +++ b/src/Model/FuturesPremiumIndex.php @@ -0,0 +1,426 @@ + 'double', + 'c' => 'string', + 'h' => 'string', + 'l' => 'string', + 'o' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 't' => 'double', + 'c' => null, + 'h' => null, + 'l' => null, + 'o' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 't' => 't', + 'c' => 'c', + 'h' => 'h', + 'l' => 'l', + 'o' => 'o' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 't' => 'setT', + 'c' => 'setC', + 'h' => 'setH', + 'l' => 'setL', + 'o' => 'setO' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 't' => 'getT', + 'c' => 'getC', + 'h' => 'getH', + 'l' => 'getL', + 'o' => 'getO' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['t'] = isset($data['t']) ? $data['t'] : null; + $this->container['c'] = isset($data['c']) ? $data['c'] : null; + $this->container['h'] = isset($data['h']) ? $data['h'] : null; + $this->container['l'] = isset($data['l']) ? $data['l'] : null; + $this->container['o'] = isset($data['o']) ? $data['o'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 t + * + * @return double|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param double|null $t Unix timestamp in seconds + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + + /** + * Gets c + * + * @return string|null + */ + public function getC() + { + return $this->container['c']; + } + + /** + * Sets c + * + * @param string|null $c Close price + * + * @return $this + */ + public function setC($c) + { + $this->container['c'] = $c; + + return $this; + } + + /** + * Gets h + * + * @return string|null + */ + public function getH() + { + return $this->container['h']; + } + + /** + * Sets h + * + * @param string|null $h Highest price + * + * @return $this + */ + public function setH($h) + { + $this->container['h'] = $h; + + return $this; + } + + /** + * Gets l + * + * @return string|null + */ + public function getL() + { + return $this->container['l']; + } + + /** + * Sets l + * + * @param string|null $l Lowest price` + * + * @return $this + */ + public function setL($l) + { + $this->container['l'] = $l; + + return $this; + } + + /** + * Gets o + * + * @return string|null + */ + public function getO() + { + return $this->container['o']; + } + + /** + * Sets o + * + * @param string|null $o Open price + * + * @return $this + */ + public function setO($o) + { + $this->container['o'] = $o; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FuturesPriceTrigger.php b/src/Model/FuturesPriceTrigger.php index be07fb8..f3948a4 100644 --- a/src/Model/FuturesPriceTrigger.php +++ b/src/Model/FuturesPriceTrigger.php @@ -42,17 +42,17 @@ class FuturesPriceTrigger implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesPriceTrigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'strategy_type' => 'int', 'price_type' => 'int', @@ -62,15 +62,15 @@ class FuturesPriceTrigger implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'strategy_type' => null, - 'price_type' => null, + 'price_type' => 'int32', 'price' => null, - 'rule' => null, + 'rule' => 'int32', 'expiration' => null ]; @@ -309,7 +309,7 @@ public function getStrategyType() /** * Sets strategy_type * - * @param int|null $strategy_type How the order will be triggered - `0`: by price, which means order will be triggered on price condition satisfied - `1`: by price gap, which means order will be triggered on gap of recent two prices of specified `price_type` satisfied. Only `0` is supported currently + * @param int|null $strategy_type How the order will be triggered - `0`: by price, which means the order will be triggered if price condition is satisfied - `1`: by price gap, which means the order will be triggered if gap of recent two prices of specified `price_type` are satisfied. Only `0` is supported currently * * @return $this */ @@ -432,7 +432,7 @@ public function getExpiration() /** * Sets expiration * - * @param int|null $expiration How many seconds will the order wait for the condition being triggered. Order will be cancelled on timed out + * @param int|null $expiration How long (in seconds) to wait for the condition to be triggered before cancelling the order. * * @return $this */ @@ -449,7 +449,7 @@ public function setExpiration($expiration) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -461,9 +461,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -474,7 +475,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -490,7 +491,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesPriceTriggeredOrder.php b/src/Model/FuturesPriceTriggeredOrder.php index 0363c9f..52489f4 100644 --- a/src/Model/FuturesPriceTriggeredOrder.php +++ b/src/Model/FuturesPriceTriggeredOrder.php @@ -43,17 +43,17 @@ class FuturesPriceTriggeredOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesPriceTriggeredOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'initial' => '\GateApi\Model\FuturesInitialOrder', 'trigger' => '\GateApi\Model\FuturesPriceTrigger', @@ -64,14 +64,16 @@ class FuturesPriceTriggeredOrder implements ModelInterface, ArrayAccess 'trade_id' => 'int', 'status' => 'string', 'finish_as' => 'string', - 'reason' => 'string' + 'reason' => 'string', + 'order_type' => 'string', + 'me_order_id' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'initial' => null, 'trigger' => null, @@ -82,7 +84,9 @@ class FuturesPriceTriggeredOrder implements ModelInterface, ArrayAccess 'trade_id' => 'int64', 'status' => null, 'finish_as' => null, - 'reason' => null + 'reason' => null, + 'order_type' => null, + 'me_order_id' => null ]; /** @@ -121,7 +125,9 @@ public static function openAPIFormats() 'trade_id' => 'trade_id', 'status' => 'status', 'finish_as' => 'finish_as', - 'reason' => 'reason' + 'reason' => 'reason', + 'order_type' => 'order_type', + 'me_order_id' => 'me_order_id' ]; /** @@ -139,7 +145,9 @@ public static function openAPIFormats() 'trade_id' => 'setTradeId', 'status' => 'setStatus', 'finish_as' => 'setFinishAs', - 'reason' => 'setReason' + 'reason' => 'setReason', + 'order_type' => 'setOrderType', + 'me_order_id' => 'setMeOrderId' ]; /** @@ -157,7 +165,9 @@ public static function openAPIFormats() 'trade_id' => 'getTradeId', 'status' => 'getStatus', 'finish_as' => 'getFinishAs', - 'reason' => 'getReason' + 'reason' => 'getReason', + 'order_type' => 'getOrderType', + 'me_order_id' => 'getMeOrderId' ]; /** @@ -203,6 +213,8 @@ public function getModelName() const STATUS_OPEN = 'open'; const STATUS_FINISHED = 'finished'; + const STATUS_INACTIVE = 'inactive'; + const STATUS_INVALID = 'invalid'; const FINISH_AS_CANCELLED = 'cancelled'; const FINISH_AS_SUCCEEDED = 'succeeded'; const FINISH_AS_FAILED = 'failed'; @@ -220,6 +232,8 @@ public function getStatusAllowableValues() return [ self::STATUS_OPEN, self::STATUS_FINISHED, + self::STATUS_INACTIVE, + self::STATUS_INVALID, ]; } @@ -264,6 +278,8 @@ public function __construct(array $data = null) $this->container['status'] = isset($data['status']) ? $data['status'] : null; $this->container['finish_as'] = isset($data['finish_as']) ? $data['finish_as'] : null; $this->container['reason'] = isset($data['reason']) ? $data['reason'] : null; + $this->container['order_type'] = isset($data['order_type']) ? $data['order_type'] : null; + $this->container['me_order_id'] = isset($data['me_order_id']) ? $data['me_order_id'] : null; } /** @@ -493,7 +509,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status Order status. + * @param string|null $status Auto order status - `open`: order is active - `finished`: order is finished - `inactive`: order is not active, only for close-long-order or close-short-order - `invalid`: order is invalid, only for close-long-order or close-short-order * * @return $this */ @@ -559,7 +575,7 @@ public function getReason() /** * Sets reason * - * @param string|null $reason Extra messages of how order is finished + * @param string|null $reason Additional remarks on how the order was finished * * @return $this */ @@ -569,6 +585,54 @@ public function setReason($reason) return $this; } + + /** + * Gets order_type + * + * @return string|null + */ + public function getOrderType() + { + return $this->container['order_type']; + } + + /** + * Sets order_type + * + * @param string|null $order_type Take-profit/stop-loss types, which include: - `close-long-order`: order take-profit/stop-loss, close long position - `close-short-order`: order take-profit/stop-loss, close short position - `close-long-position`: position take-profit/stop-loss, close long position - `close-short-position`: position take-profit/stop-loss, close short position - `plan-close-long-position`: position planned take-profit/stop-loss, close long position - `plan-close-short-position`: position planned take-profit/stop-loss, close short position The order take-profit/stop-loss can not be passed by request. These two types are read only. + * + * @return $this + */ + public function setOrderType($order_type) + { + $this->container['order_type'] = $order_type; + + return $this; + } + + /** + * Gets me_order_id + * + * @return string|null + */ + public function getMeOrderId() + { + return $this->container['me_order_id']; + } + + /** + * Sets me_order_id + * + * @param string|null $me_order_id Corresponding order ID of order take-profit/stop-loss. + * + * @return $this + */ + public function setMeOrderId($me_order_id) + { + $this->container['me_order_id'] = $me_order_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -576,7 +640,7 @@ public function setReason($reason) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -588,9 +652,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -601,7 +666,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -617,7 +682,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesTicker.php b/src/Model/FuturesTicker.php index 03767cd..89c530f 100644 --- a/src/Model/FuturesTicker.php +++ b/src/Model/FuturesTicker.php @@ -42,17 +42,17 @@ class FuturesTicker implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesTicker'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'contract' => 'string', 'last' => 'string', @@ -70,14 +70,16 @@ class FuturesTicker implements ModelInterface, ArrayAccess 'funding_rate' => 'string', 'funding_rate_indicative' => 'string', 'index_price' => 'string', - 'quanto_base_rate' => 'string' + 'quanto_base_rate' => 'string', + 'basis_rate' => 'string', + 'basis_value' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'contract' => null, 'last' => null, @@ -95,7 +97,9 @@ class FuturesTicker implements ModelInterface, ArrayAccess 'funding_rate' => null, 'funding_rate_indicative' => null, 'index_price' => null, - 'quanto_base_rate' => null + 'quanto_base_rate' => null, + 'basis_rate' => null, + 'basis_value' => null ]; /** @@ -141,7 +145,9 @@ public static function openAPIFormats() 'funding_rate' => 'funding_rate', 'funding_rate_indicative' => 'funding_rate_indicative', 'index_price' => 'index_price', - 'quanto_base_rate' => 'quanto_base_rate' + 'quanto_base_rate' => 'quanto_base_rate', + 'basis_rate' => 'basis_rate', + 'basis_value' => 'basis_value' ]; /** @@ -166,7 +172,9 @@ public static function openAPIFormats() 'funding_rate' => 'setFundingRate', 'funding_rate_indicative' => 'setFundingRateIndicative', 'index_price' => 'setIndexPrice', - 'quanto_base_rate' => 'setQuantoBaseRate' + 'quanto_base_rate' => 'setQuantoBaseRate', + 'basis_rate' => 'setBasisRate', + 'basis_value' => 'setBasisValue' ]; /** @@ -191,7 +199,9 @@ public static function openAPIFormats() 'funding_rate' => 'getFundingRate', 'funding_rate_indicative' => 'getFundingRateIndicative', 'index_price' => 'getIndexPrice', - 'quanto_base_rate' => 'getQuantoBaseRate' + 'quanto_base_rate' => 'getQuantoBaseRate', + 'basis_rate' => 'getBasisRate', + 'basis_value' => 'getBasisValue' ]; /** @@ -271,6 +281,8 @@ public function __construct(array $data = null) $this->container['funding_rate_indicative'] = isset($data['funding_rate_indicative']) ? $data['funding_rate_indicative'] : null; $this->container['index_price'] = isset($data['index_price']) ? $data['index_price'] : null; $this->container['quanto_base_rate'] = isset($data['quanto_base_rate']) ? $data['quanto_base_rate'] : null; + $this->container['basis_rate'] = isset($data['basis_rate']) ? $data['basis_rate'] : null; + $this->container['basis_value'] = isset($data['basis_value']) ? $data['basis_value'] : null; } /** @@ -694,7 +706,7 @@ public function getQuantoBaseRate() /** * Sets quanto_base_rate * - * @param string|null $quanto_base_rate Exchange rate of base currency and settlement currency in Quanto contract. Not existed in contract of other types + * @param string|null $quanto_base_rate Exchange rate of base currency and settlement currency in Quanto contract. Does not exists in contracts of other types * * @return $this */ @@ -704,6 +716,54 @@ public function setQuantoBaseRate($quanto_base_rate) return $this; } + + /** + * Gets basis_rate + * + * @return string|null + */ + public function getBasisRate() + { + return $this->container['basis_rate']; + } + + /** + * Sets basis_rate + * + * @param string|null $basis_rate Basis rate + * + * @return $this + */ + public function setBasisRate($basis_rate) + { + $this->container['basis_rate'] = $basis_rate; + + return $this; + } + + /** + * Gets basis_value + * + * @return string|null + */ + public function getBasisValue() + { + return $this->container['basis_value']; + } + + /** + * Sets basis_value + * + * @param string|null $basis_value Basis value + * + * @return $this + */ + public function setBasisValue($basis_value) + { + $this->container['basis_value'] = $basis_value; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -711,7 +771,7 @@ public function setQuantoBaseRate($quanto_base_rate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -723,9 +783,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -736,7 +797,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -752,7 +813,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/FuturesTrade.php b/src/Model/FuturesTrade.php index cf12d37..d5c80cd 100644 --- a/src/Model/FuturesTrade.php +++ b/src/Model/FuturesTrade.php @@ -42,17 +42,17 @@ class FuturesTrade implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'FuturesTrade'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'create_time' => 'double', @@ -63,10 +63,10 @@ class FuturesTrade implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64', 'create_time' => 'double', @@ -364,7 +364,7 @@ public function getPrice() /** * Sets price * - * @param string|null $price Trading price + * @param string|null $price Trading price (quote currency) * * @return $this */ @@ -381,7 +381,7 @@ public function setPrice($price) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -393,9 +393,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -406,7 +407,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -422,7 +423,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/IndexConstituent.php b/src/Model/IndexConstituent.php new file mode 100644 index 0000000..59218b7 --- /dev/null +++ b/src/Model/IndexConstituent.php @@ -0,0 +1,335 @@ + 'string', + 'symbols' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'exchange' => null, + 'symbols' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'exchange' => 'exchange', + 'symbols' => 'symbols' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exchange' => 'setExchange', + 'symbols' => 'setSymbols' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exchange' => 'getExchange', + 'symbols' => 'getSymbols' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['exchange'] = isset($data['exchange']) ? $data['exchange'] : null; + $this->container['symbols'] = isset($data['symbols']) ? $data['symbols'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 exchange + * + * @return string|null + */ + public function getExchange() + { + return $this->container['exchange']; + } + + /** + * Sets exchange + * + * @param string|null $exchange Exchange + * + * @return $this + */ + public function setExchange($exchange) + { + $this->container['exchange'] = $exchange; + + return $this; + } + + /** + * Gets symbols + * + * @return string[]|null + */ + public function getSymbols() + { + return $this->container['symbols']; + } + + /** + * Sets symbols + * + * @param string[]|null $symbols Symbol list + * + * @return $this + */ + public function setSymbols($symbols) + { + $this->container['symbols'] = $symbols; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/InsuranceRecord.php b/src/Model/InsuranceRecord.php index c143a5d..4c89cf8 100644 --- a/src/Model/InsuranceRecord.php +++ b/src/Model/InsuranceRecord.php @@ -42,27 +42,27 @@ class InsuranceRecord implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'InsuranceRecord'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 't' => 'int', 'b' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 't' => 'int64', 'b' => null @@ -261,7 +261,7 @@ public function setB($b) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -273,9 +273,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -286,7 +287,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -302,7 +303,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/LedgerRecord.php b/src/Model/LedgerRecord.php index fced5fe..0e9a670 100644 --- a/src/Model/LedgerRecord.php +++ b/src/Model/LedgerRecord.php @@ -42,44 +42,48 @@ class LedgerRecord implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'LedgerRecord'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'txid' => 'string', + 'withdraw_order_id' => 'string', 'timestamp' => 'string', 'amount' => 'string', 'currency' => 'string', 'address' => 'string', 'memo' => 'string', 'status' => 'string', - 'chain' => 'string' + 'chain' => 'string', + 'fee' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'txid' => null, + 'withdraw_order_id' => null, 'timestamp' => null, 'amount' => null, 'currency' => null, 'address' => null, 'memo' => null, 'status' => null, - 'chain' => null + 'chain' => null, + 'fee' => null ]; /** @@ -111,13 +115,15 @@ public static function openAPIFormats() protected static $attributeMap = [ 'id' => 'id', 'txid' => 'txid', + 'withdraw_order_id' => 'withdraw_order_id', 'timestamp' => 'timestamp', 'amount' => 'amount', 'currency' => 'currency', 'address' => 'address', 'memo' => 'memo', 'status' => 'status', - 'chain' => 'chain' + 'chain' => 'chain', + 'fee' => 'fee' ]; /** @@ -128,13 +134,15 @@ public static function openAPIFormats() protected static $setters = [ 'id' => 'setId', 'txid' => 'setTxid', + 'withdraw_order_id' => 'setWithdrawOrderId', 'timestamp' => 'setTimestamp', 'amount' => 'setAmount', 'currency' => 'setCurrency', 'address' => 'setAddress', 'memo' => 'setMemo', 'status' => 'setStatus', - 'chain' => 'setChain' + 'chain' => 'setChain', + 'fee' => 'setFee' ]; /** @@ -145,13 +153,15 @@ public static function openAPIFormats() protected static $getters = [ 'id' => 'getId', 'txid' => 'getTxid', + 'withdraw_order_id' => 'getWithdrawOrderId', 'timestamp' => 'getTimestamp', 'amount' => 'getAmount', 'currency' => 'getCurrency', 'address' => 'getAddress', 'memo' => 'getMemo', 'status' => 'getStatus', - 'chain' => 'getChain' + 'chain' => 'getChain', + 'fee' => 'getFee' ]; /** @@ -200,6 +210,14 @@ public function getModelName() const STATUS_REQUEST = 'REQUEST'; const STATUS_MANUAL = 'MANUAL'; const STATUS_BCODE = 'BCODE'; + const STATUS_EXTPEND = 'EXTPEND'; + const STATUS_FAIL = 'FAIL'; + const STATUS_INVALID = 'INVALID'; + const STATUS_VERIFY = 'VERIFY'; + const STATUS_PROCES = 'PROCES'; + const STATUS_PEND = 'PEND'; + const STATUS_DMOVE = 'DMOVE'; + const STATUS_SPLITPEND = 'SPLITPEND'; @@ -216,6 +234,14 @@ public function getStatusAllowableValues() self::STATUS_REQUEST, self::STATUS_MANUAL, self::STATUS_BCODE, + self::STATUS_EXTPEND, + self::STATUS_FAIL, + self::STATUS_INVALID, + self::STATUS_VERIFY, + self::STATUS_PROCES, + self::STATUS_PEND, + self::STATUS_DMOVE, + self::STATUS_SPLITPEND, ]; } @@ -237,6 +263,7 @@ public function __construct(array $data = null) { $this->container['id'] = isset($data['id']) ? $data['id'] : null; $this->container['txid'] = isset($data['txid']) ? $data['txid'] : null; + $this->container['withdraw_order_id'] = isset($data['withdraw_order_id']) ? $data['withdraw_order_id'] : null; $this->container['timestamp'] = isset($data['timestamp']) ? $data['timestamp'] : null; $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; @@ -244,6 +271,7 @@ public function __construct(array $data = null) $this->container['memo'] = isset($data['memo']) ? $data['memo'] : null; $this->container['status'] = isset($data['status']) ? $data['status'] : null; $this->container['chain'] = isset($data['chain']) ? $data['chain'] : null; + $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; } /** @@ -269,6 +297,9 @@ public function listInvalidProperties() ); } + if ($this->container['chain'] === null) { + $invalidProperties[] = "'chain' can't be null"; + } return $invalidProperties; } @@ -332,6 +363,30 @@ public function setTxid($txid) return $this; } + /** + * Gets withdraw_order_id + * + * @return string|null + */ + public function getWithdrawOrderId() + { + return $this->container['withdraw_order_id']; + } + + /** + * Sets withdraw_order_id + * + * @param string|null $withdraw_order_id Client order id, up to 32 length and can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) + * + * @return $this + */ + public function setWithdrawOrderId($withdraw_order_id) + { + $this->container['withdraw_order_id'] = $withdraw_order_id; + + return $this; + } + /** * Gets timestamp * @@ -441,7 +496,7 @@ public function getMemo() /** * Sets memo * - * @param string|null $memo Extra withdrawal memo + * @param string|null $memo Additional remarks with regards to the withdrawal * * @return $this */ @@ -465,7 +520,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status Record status. - DONE: done - CANCEL: cancelled - REQUEST: requesting - MANUAL: waiting for manual approval - BCODE: GateCode operation + * @param string|null $status Record status. - DONE: done - CANCEL: cancelled - REQUEST: requesting - MANUAL: pending manual approval - BCODE: GateCode operation - EXTPEND: pending confirm after sending - FAIL: pending confirm when fail - INVALID: invalid order - VERIFY: verifying - PROCES: processing - PEND: pending - DMOVE: required manual approval - SPLITPEND: the order is automatically split due to large amount * * @return $this */ @@ -488,7 +543,7 @@ public function setStatus($status) /** * Gets chain * - * @return string|null + * @return string */ public function getChain() { @@ -498,7 +553,7 @@ public function getChain() /** * Sets chain * - * @param string|null $chain Name of the chain used in withdrawals + * @param string $chain Name of the chain used in withdrawals * * @return $this */ @@ -508,6 +563,30 @@ public function setChain($chain) return $this; } + + /** + * Gets fee + * + * @return string|null + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param string|null $fee Fee + * + * @return $this + */ + public function setFee($fee) + { + $this->container['fee'] = $fee; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -515,7 +594,7 @@ public function setChain($chain) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -527,9 +606,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -540,7 +620,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -556,7 +636,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/LiquidateOrder.php b/src/Model/LiquidateOrder.php new file mode 100644 index 0000000..06cfd45 --- /dev/null +++ b/src/Model/LiquidateOrder.php @@ -0,0 +1,405 @@ + 'string', + 'currency_pair' => 'string', + 'amount' => 'string', + 'price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'text' => null, + 'currency_pair' => null, + 'amount' => null, + 'price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'text' => 'text', + 'currency_pair' => 'currency_pair', + 'amount' => 'amount', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'text' => 'setText', + 'currency_pair' => 'setCurrencyPair', + 'amount' => 'setAmount', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'text' => 'getText', + 'currency_pair' => 'getCurrencyPair', + 'amount' => 'getAmount', + 'price' => 'getPrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['text'] = isset($data['text']) ? $data['text'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency_pair'] === null) { + $invalidProperties[] = "'currency_pair' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['price'] === null) { + $invalidProperties[] = "'price' 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 text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets currency_pair + * + * @return string + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + + /** + * Gets amount + * + * @return string + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string $amount Trade amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets price + * + * @return string + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string $price Order price + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Loan.php b/src/Model/Loan.php index 98aa880..455d39a 100644 --- a/src/Model/Loan.php +++ b/src/Model/Loan.php @@ -43,17 +43,17 @@ class Loan implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Loan'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'create_time' => 'string', @@ -71,14 +71,15 @@ class Loan implements ModelInterface, ArrayAccess 'paid_interest' => 'string', 'unpaid_interest' => 'string', 'fee_rate' => 'string', - 'orig_id' => 'string' + 'orig_id' => 'string', + 'text' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'create_time' => null, @@ -96,7 +97,8 @@ class Loan implements ModelInterface, ArrayAccess 'paid_interest' => null, 'unpaid_interest' => null, 'fee_rate' => null, - 'orig_id' => null + 'orig_id' => null, + 'text' => null ]; /** @@ -142,7 +144,8 @@ public static function openAPIFormats() 'paid_interest' => 'paid_interest', 'unpaid_interest' => 'unpaid_interest', 'fee_rate' => 'fee_rate', - 'orig_id' => 'orig_id' + 'orig_id' => 'orig_id', + 'text' => 'text' ]; /** @@ -167,7 +170,8 @@ public static function openAPIFormats() 'paid_interest' => 'setPaidInterest', 'unpaid_interest' => 'setUnpaidInterest', 'fee_rate' => 'setFeeRate', - 'orig_id' => 'setOrigId' + 'orig_id' => 'setOrigId', + 'text' => 'setText' ]; /** @@ -192,7 +196,8 @@ public static function openAPIFormats() 'paid_interest' => 'getPaidInterest', 'unpaid_interest' => 'getUnpaidInterest', 'fee_rate' => 'getFeeRate', - 'orig_id' => 'getOrigId' + 'orig_id' => 'getOrigId', + 'text' => 'getText' ]; /** @@ -306,6 +311,7 @@ public function __construct(array $data = null) $this->container['unpaid_interest'] = isset($data['unpaid_interest']) ? $data['unpaid_interest'] : null; $this->container['fee_rate'] = isset($data['fee_rate']) ? $data['fee_rate'] : null; $this->container['orig_id'] = isset($data['orig_id']) ? $data['orig_id'] : null; + $this->container['text'] = isset($data['text']) ? $data['text'] : null; } /** @@ -342,9 +348,6 @@ public function listInvalidProperties() if ($this->container['amount'] === null) { $invalidProperties[] = "'amount' can't be null"; } - if ($this->container['days'] === null) { - $invalidProperties[] = "'days' can't be null"; - } return $invalidProperties; } @@ -535,7 +538,7 @@ public function getRate() /** * Sets rate * - * @param string|null $rate Loan rate. Only rates in [0.0002, 0.002] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set + * @param string|null $rate Loan rate. Only rates in [0.0001, 0.01] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set * * @return $this */ @@ -573,7 +576,7 @@ public function setAmount($amount) /** * Gets days * - * @return int + * @return int|null */ public function getDays() { @@ -583,7 +586,7 @@ public function getDays() /** * Sets days * - * @param int $days Loan days + * @param int|null $days Loan days. Only 10 is supported for now * * @return $this */ @@ -607,7 +610,7 @@ public function getAutoRenew() /** * Sets auto_renew * - * @param bool|null $auto_renew Auto renew the loan on expiration + * @param bool|null $auto_renew Whether to auto renew the loan upon expiration * * @return $this */ @@ -631,7 +634,7 @@ public function getCurrencyPair() /** * Sets currency_pair * - * @param string|null $currency_pair Currency pair. Required for borrowing side + * @param string|null $currency_pair Currency pair. Required if borrowing * * @return $this */ @@ -655,7 +658,7 @@ public function getLeft() /** * Sets left * - * @param string|null $left Amount not lending out + * @param string|null $left Amount not lent out yet * * @return $this */ @@ -727,7 +730,7 @@ public function getUnpaidInterest() /** * Sets unpaid_interest * - * @param string|null $unpaid_interest Interest not repaid + * @param string|null $unpaid_interest Outstanding interest yet to be paid * * @return $this */ @@ -775,7 +778,7 @@ public function getOrigId() /** * Sets orig_id * - * @param string|null $orig_id Original loan ID if the loan is auto-renewed. Equal to `id` if not + * @param string|null $orig_id Original loan ID of the loan if auto-renewed, otherwise equals to id * * @return $this */ @@ -785,6 +788,30 @@ public function setOrigId($orig_id) return $this; } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text User defined custom ID + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -792,7 +819,7 @@ public function setOrigId($orig_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -804,9 +831,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -817,7 +845,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -833,7 +861,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/LoanPatch.php b/src/Model/LoanPatch.php index 88fd283..4b3c73f 100644 --- a/src/Model/LoanPatch.php +++ b/src/Model/LoanPatch.php @@ -42,17 +42,17 @@ class LoanPatch implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'LoanPatch'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'side' => 'string', @@ -62,10 +62,10 @@ class LoanPatch implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'side' => null, @@ -351,7 +351,7 @@ public function getCurrencyPair() /** * Sets currency_pair * - * @param string|null $currency_pair Currency pair. Required for borrowing side + * @param string|null $currency_pair Currency pair. Required if borrowing * * @return $this */ @@ -392,7 +392,7 @@ public function setLoanId($loan_id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -404,9 +404,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -417,7 +418,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -433,7 +434,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/LoanRecord.php b/src/Model/LoanRecord.php index 4d072fa..547971e 100644 --- a/src/Model/LoanRecord.php +++ b/src/Model/LoanRecord.php @@ -43,17 +43,17 @@ class LoanRecord implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'LoanRecord'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'loan_id' => 'string', @@ -72,10 +72,10 @@ class LoanRecord implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'loan_id' => null, @@ -637,7 +637,7 @@ public function getUnpaidInterest() /** * Sets unpaid_interest * - * @param string|null $unpaid_interest Interest not repaid + * @param string|null $unpaid_interest Outstanding interest yet to be paid * * @return $this */ @@ -654,7 +654,7 @@ public function setUnpaidInterest($unpaid_interest) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -666,9 +666,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -679,7 +680,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -695,7 +696,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/MarginAccount.php b/src/Model/MarginAccount.php index 52095b1..18d670f 100644 --- a/src/Model/MarginAccount.php +++ b/src/Model/MarginAccount.php @@ -43,30 +43,34 @@ class MarginAccount implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'MarginAccount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency_pair' => 'string', + 'locked' => 'bool', + 'risk' => 'string', 'base' => '\GateApi\Model\MarginAccountCurrency', 'quote' => '\GateApi\Model\MarginAccountCurrency' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency_pair' => null, + 'locked' => null, + 'risk' => null, 'base' => null, 'quote' => null ]; @@ -99,6 +103,8 @@ public static function openAPIFormats() */ protected static $attributeMap = [ 'currency_pair' => 'currency_pair', + 'locked' => 'locked', + 'risk' => 'risk', 'base' => 'base', 'quote' => 'quote' ]; @@ -110,6 +116,8 @@ public static function openAPIFormats() */ protected static $setters = [ 'currency_pair' => 'setCurrencyPair', + 'locked' => 'setLocked', + 'risk' => 'setRisk', 'base' => 'setBase', 'quote' => 'setQuote' ]; @@ -121,6 +129,8 @@ public static function openAPIFormats() */ protected static $getters = [ 'currency_pair' => 'getCurrencyPair', + 'locked' => 'getLocked', + 'risk' => 'getRisk', 'base' => 'getBase', 'quote' => 'getQuote' ]; @@ -186,6 +196,8 @@ public function getModelName() public function __construct(array $data = null) { $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['locked'] = isset($data['locked']) ? $data['locked'] : null; + $this->container['risk'] = isset($data['risk']) ? $data['risk'] : null; $this->container['base'] = isset($data['base']) ? $data['base'] : null; $this->container['quote'] = isset($data['quote']) ? $data['quote'] : null; } @@ -238,6 +250,54 @@ public function setCurrencyPair($currency_pair) return $this; } + /** + * Gets locked + * + * @return bool|null + */ + public function getLocked() + { + return $this->container['locked']; + } + + /** + * Sets locked + * + * @param bool|null $locked Whether account is locked + * + * @return $this + */ + public function setLocked($locked) + { + $this->container['locked'] = $locked; + + return $this; + } + + /** + * Gets risk + * + * @return string|null + */ + public function getRisk() + { + return $this->container['risk']; + } + + /** + * Sets risk + * + * @param string|null $risk Current risk rate of margin account + * + * @return $this + */ + public function setRisk($risk) + { + $this->container['risk'] = $risk; + + return $this; + } + /** * Gets base * @@ -292,7 +352,7 @@ public function setQuote($quote) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,9 +364,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -317,7 +378,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -333,7 +394,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/MarginAccountBook.php b/src/Model/MarginAccountBook.php index 702368d..56ac9cc 100644 --- a/src/Model/MarginAccountBook.php +++ b/src/Model/MarginAccountBook.php @@ -42,20 +42,21 @@ class MarginAccountBook implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'MarginAccountBook'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'time' => 'string', + 'time_ms' => 'int', 'currency' => 'string', 'currency_pair' => 'string', 'change' => 'string', @@ -63,13 +64,14 @@ class MarginAccountBook implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'time' => null, + 'time_ms' => 'int64', 'currency' => null, 'currency_pair' => null, 'change' => null, @@ -105,6 +107,7 @@ public static function openAPIFormats() protected static $attributeMap = [ 'id' => 'id', 'time' => 'time', + 'time_ms' => 'time_ms', 'currency' => 'currency', 'currency_pair' => 'currency_pair', 'change' => 'change', @@ -119,6 +122,7 @@ public static function openAPIFormats() protected static $setters = [ 'id' => 'setId', 'time' => 'setTime', + 'time_ms' => 'setTimeMs', 'currency' => 'setCurrency', 'currency_pair' => 'setCurrencyPair', 'change' => 'setChange', @@ -133,6 +137,7 @@ public static function openAPIFormats() protected static $getters = [ 'id' => 'getId', 'time' => 'getTime', + 'time_ms' => 'getTimeMs', 'currency' => 'getCurrency', 'currency_pair' => 'getCurrencyPair', 'change' => 'getChange', @@ -201,6 +206,7 @@ public function __construct(array $data = null) { $this->container['id'] = isset($data['id']) ? $data['id'] : null; $this->container['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['time_ms'] = isset($data['time_ms']) ? $data['time_ms'] : null; $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; $this->container['change'] = isset($data['change']) ? $data['change'] : null; @@ -279,6 +285,30 @@ public function setTime($time) return $this; } + /** + * Gets time_ms + * + * @return int|null + */ + public function getTimeMs() + { + return $this->container['time_ms']; + } + + /** + * Sets time_ms + * + * @param int|null $time_ms The timestamp of the change (in milliseconds) + * + * @return $this + */ + public function setTimeMs($time_ms) + { + $this->container['time_ms'] = $time_ms; + + return $this; + } + /** * Gets currency * @@ -381,7 +411,7 @@ public function setBalance($balance) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -393,9 +423,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -406,7 +437,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -422,7 +453,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/MarginAccountCurrency.php b/src/Model/MarginAccountCurrency.php index cae2448..f6549cd 100644 --- a/src/Model/MarginAccountCurrency.php +++ b/src/Model/MarginAccountCurrency.php @@ -33,7 +33,7 @@ * MarginAccountCurrency Class Doc Comment * * @category Class - * @description Account currency detail + * @description Account currency details * @package GateApi * @author GateIO * @link https://www.gate.io @@ -43,17 +43,17 @@ class MarginAccountCurrency implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'MarginAccountCurrency'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'available' => 'string', @@ -63,10 +63,10 @@ class MarginAccountCurrency implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'available' => null, @@ -335,7 +335,7 @@ public function getInterest() /** * Sets interest * - * @param string|null $interest Interests unpaid + * @param string|null $interest Unpaid interests * * @return $this */ @@ -352,7 +352,7 @@ public function setInterest($interest) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -364,9 +364,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -377,7 +378,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -393,7 +394,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/MarginBorrowable.php b/src/Model/MarginBorrowable.php new file mode 100644 index 0000000..0efc6bf --- /dev/null +++ b/src/Model/MarginBorrowable.php @@ -0,0 +1,365 @@ + 'string', + 'currency_pair' => 'string', + 'amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'currency_pair' => null, + 'amount' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'currency_pair' => 'currency_pair', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'currency_pair' => 'setCurrencyPair', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'currency_pair' => 'getCurrencyPair', + 'amount' => 'getAmount' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency detail + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + + /** + * Gets amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Max borrowable amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MarginCurrencyPair.php b/src/Model/MarginCurrencyPair.php index 392411d..4fdb985 100644 --- a/src/Model/MarginCurrencyPair.php +++ b/src/Model/MarginCurrencyPair.php @@ -42,17 +42,17 @@ class MarginCurrencyPair implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'MarginCurrencyPair'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'base' => 'string', @@ -60,14 +60,15 @@ class MarginCurrencyPair implements ModelInterface, ArrayAccess 'leverage' => 'int', 'min_base_amount' => 'string', 'min_quote_amount' => 'string', - 'max_quote_amount' => 'string' + 'max_quote_amount' => 'string', + 'status' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'base' => null, @@ -75,7 +76,8 @@ class MarginCurrencyPair implements ModelInterface, ArrayAccess 'leverage' => null, 'min_base_amount' => null, 'min_quote_amount' => null, - 'max_quote_amount' => null + 'max_quote_amount' => null, + 'status' => 'int32' ]; /** @@ -111,7 +113,8 @@ public static function openAPIFormats() 'leverage' => 'leverage', 'min_base_amount' => 'min_base_amount', 'min_quote_amount' => 'min_quote_amount', - 'max_quote_amount' => 'max_quote_amount' + 'max_quote_amount' => 'max_quote_amount', + 'status' => 'status' ]; /** @@ -126,7 +129,8 @@ public static function openAPIFormats() 'leverage' => 'setLeverage', 'min_base_amount' => 'setMinBaseAmount', 'min_quote_amount' => 'setMinQuoteAmount', - 'max_quote_amount' => 'setMaxQuoteAmount' + 'max_quote_amount' => 'setMaxQuoteAmount', + 'status' => 'setStatus' ]; /** @@ -141,7 +145,8 @@ public static function openAPIFormats() 'leverage' => 'getLeverage', 'min_base_amount' => 'getMinBaseAmount', 'min_quote_amount' => 'getMinQuoteAmount', - 'max_quote_amount' => 'getMaxQuoteAmount' + 'max_quote_amount' => 'getMaxQuoteAmount', + 'status' => 'getStatus' ]; /** @@ -211,6 +216,7 @@ public function __construct(array $data = null) $this->container['min_base_amount'] = isset($data['min_base_amount']) ? $data['min_base_amount'] : null; $this->container['min_quote_amount'] = isset($data['min_quote_amount']) ? $data['min_quote_amount'] : null; $this->container['max_quote_amount'] = isset($data['max_quote_amount']) ? $data['max_quote_amount'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; } /** @@ -404,6 +410,30 @@ public function setMaxQuoteAmount($max_quote_amount) return $this; } + + /** + * Gets status + * + * @return int|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int|null $status Currency pair status - `0`: disabled - `1`: enabled + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -411,7 +441,7 @@ public function setMaxQuoteAmount($max_quote_amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -423,9 +453,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -436,7 +467,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -452,7 +483,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/MarginTransferable.php b/src/Model/MarginTransferable.php new file mode 100644 index 0000000..5c4a7e1 --- /dev/null +++ b/src/Model/MarginTransferable.php @@ -0,0 +1,365 @@ + 'string', + 'currency_pair' => 'string', + 'amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'currency_pair' => null, + 'amount' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'currency_pair' => 'currency_pair', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'currency_pair' => 'setCurrencyPair', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'currency_pair' => 'getCurrencyPair', + 'amount' => 'getAmount' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency detail + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + + /** + * Gets amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Max transferable amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChainAddressItem.php b/src/Model/MultiChainAddressItem.php index 967d8fa..7843ed0 100644 --- a/src/Model/MultiChainAddressItem.php +++ b/src/Model/MultiChainAddressItem.php @@ -42,17 +42,17 @@ class MultiChainAddressItem implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'MultiChainAddressItem'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'chain' => 'string', 'address' => 'string', @@ -62,10 +62,10 @@ class MultiChainAddressItem implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'chain' => null, 'address' => null, @@ -334,7 +334,7 @@ public function getObtainFailed() /** * Sets obtain_failed * - * @param int|null $obtain_failed Whether address is obtained. 0 means success. 1 is failure, which needs retries + * @param int|null $obtain_failed The obtain failed status- 0: address successfully obtained- 1: failed to obtain address * * @return $this */ @@ -351,7 +351,7 @@ public function setObtainFailed($obtain_failed) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -363,9 +363,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -376,7 +377,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -392,7 +393,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/MyFuturesTrade.php b/src/Model/MyFuturesTrade.php index cf62509..bc9e14f 100644 --- a/src/Model/MyFuturesTrade.php +++ b/src/Model/MyFuturesTrade.php @@ -42,17 +42,17 @@ class MyFuturesTrade implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'MyFuturesTrade'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'create_time' => 'double', @@ -60,14 +60,17 @@ class MyFuturesTrade implements ModelInterface, ArrayAccess 'order_id' => 'string', 'size' => 'int', 'price' => 'string', - 'role' => 'string' + 'role' => 'string', + 'text' => 'string', + 'fee' => 'string', + 'point_fee' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64', 'create_time' => 'double', @@ -75,7 +78,10 @@ class MyFuturesTrade implements ModelInterface, ArrayAccess 'order_id' => null, 'size' => 'int64', 'price' => null, - 'role' => null + 'role' => null, + 'text' => null, + 'fee' => null, + 'point_fee' => null ]; /** @@ -111,7 +117,10 @@ public static function openAPIFormats() 'order_id' => 'order_id', 'size' => 'size', 'price' => 'price', - 'role' => 'role' + 'role' => 'role', + 'text' => 'text', + 'fee' => 'fee', + 'point_fee' => 'point_fee' ]; /** @@ -126,7 +135,10 @@ public static function openAPIFormats() 'order_id' => 'setOrderId', 'size' => 'setSize', 'price' => 'setPrice', - 'role' => 'setRole' + 'role' => 'setRole', + 'text' => 'setText', + 'fee' => 'setFee', + 'point_fee' => 'setPointFee' ]; /** @@ -141,7 +153,10 @@ public static function openAPIFormats() 'order_id' => 'getOrderId', 'size' => 'getSize', 'price' => 'getPrice', - 'role' => 'getRole' + 'role' => 'getRole', + 'text' => 'getText', + 'fee' => 'getFee', + 'point_fee' => 'getPointFee' ]; /** @@ -226,6 +241,9 @@ public function __construct(array $data = null) $this->container['size'] = isset($data['size']) ? $data['size'] : null; $this->container['price'] = isset($data['price']) ? $data['price'] : null; $this->container['role'] = isset($data['role']) ? $data['role'] : null; + $this->container['text'] = isset($data['text']) ? $data['text'] : null; + $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; + $this->container['point_fee'] = isset($data['point_fee']) ? $data['point_fee'] : null; } /** @@ -436,6 +454,78 @@ public function setRole($role) return $this; } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text User defined information + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets fee + * + * @return string|null + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param string|null $fee Fee deducted + * + * @return $this + */ + public function setFee($fee) + { + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets point_fee + * + * @return string|null + */ + public function getPointFee() + { + return $this->container['point_fee']; + } + + /** + * Sets point_fee + * + * @param string|null $point_fee Points used to deduct fee + * + * @return $this + */ + public function setPointFee($point_fee) + { + $this->container['point_fee'] = $point_fee; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -443,7 +533,7 @@ public function setRole($role) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -455,9 +545,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -468,7 +559,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -484,7 +575,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/OpenOrders.php b/src/Model/OpenOrders.php index 4ee2586..379ad3c 100644 --- a/src/Model/OpenOrders.php +++ b/src/Model/OpenOrders.php @@ -42,17 +42,17 @@ class OpenOrders implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'OpenOrders'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency_pair' => 'string', 'total' => 'int', @@ -60,10 +60,10 @@ class OpenOrders implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency_pair' => null, 'total' => null, @@ -291,7 +291,7 @@ public function setOrders($orders) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -303,9 +303,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -316,7 +317,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -332,7 +333,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/OptionsAccount.php b/src/Model/OptionsAccount.php new file mode 100644 index 0000000..facfeda --- /dev/null +++ b/src/Model/OptionsAccount.php @@ -0,0 +1,575 @@ + 'int', + 'total' => 'string', + 'short_enabled' => 'bool', + 'unrealised_pnl' => 'string', + 'init_margin' => 'string', + 'maint_margin' => 'string', + 'order_margin' => 'string', + 'available' => 'string', + 'point' => 'string', + 'currency' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'user' => null, + 'total' => null, + 'short_enabled' => null, + 'unrealised_pnl' => null, + 'init_margin' => null, + 'maint_margin' => null, + 'order_margin' => null, + 'available' => null, + 'point' => null, + 'currency' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user' => 'user', + 'total' => 'total', + 'short_enabled' => 'short_enabled', + 'unrealised_pnl' => 'unrealised_pnl', + 'init_margin' => 'init_margin', + 'maint_margin' => 'maint_margin', + 'order_margin' => 'order_margin', + 'available' => 'available', + 'point' => 'point', + 'currency' => 'currency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user' => 'setUser', + 'total' => 'setTotal', + 'short_enabled' => 'setShortEnabled', + 'unrealised_pnl' => 'setUnrealisedPnl', + 'init_margin' => 'setInitMargin', + 'maint_margin' => 'setMaintMargin', + 'order_margin' => 'setOrderMargin', + 'available' => 'setAvailable', + 'point' => 'setPoint', + 'currency' => 'setCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user' => 'getUser', + 'total' => 'getTotal', + 'short_enabled' => 'getShortEnabled', + 'unrealised_pnl' => 'getUnrealisedPnl', + 'init_margin' => 'getInitMargin', + 'maint_margin' => 'getMaintMargin', + 'order_margin' => 'getOrderMargin', + 'available' => 'getAvailable', + 'point' => 'getPoint', + 'currency' => 'getCurrency' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['user'] = isset($data['user']) ? $data['user'] : null; + $this->container['total'] = isset($data['total']) ? $data['total'] : null; + $this->container['short_enabled'] = isset($data['short_enabled']) ? $data['short_enabled'] : null; + $this->container['unrealised_pnl'] = isset($data['unrealised_pnl']) ? $data['unrealised_pnl'] : null; + $this->container['init_margin'] = isset($data['init_margin']) ? $data['init_margin'] : null; + $this->container['maint_margin'] = isset($data['maint_margin']) ? $data['maint_margin'] : null; + $this->container['order_margin'] = isset($data['order_margin']) ? $data['order_margin'] : null; + $this->container['available'] = isset($data['available']) ? $data['available'] : null; + $this->container['point'] = isset($data['point']) ? $data['point'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 user + * + * @return int|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param int|null $user User ID + * + * @return $this + */ + public function setUser($user) + { + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets total + * + * @return string|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param string|null $total Total account balance + * + * @return $this + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets short_enabled + * + * @return bool|null + */ + public function getShortEnabled() + { + return $this->container['short_enabled']; + } + + /** + * Sets short_enabled + * + * @param bool|null $short_enabled If the account is allowed to short + * + * @return $this + */ + public function setShortEnabled($short_enabled) + { + $this->container['short_enabled'] = $short_enabled; + + return $this; + } + + /** + * Gets unrealised_pnl + * + * @return string|null + */ + public function getUnrealisedPnl() + { + return $this->container['unrealised_pnl']; + } + + /** + * Sets unrealised_pnl + * + * @param string|null $unrealised_pnl Unrealized PNL + * + * @return $this + */ + public function setUnrealisedPnl($unrealised_pnl) + { + $this->container['unrealised_pnl'] = $unrealised_pnl; + + return $this; + } + + /** + * Gets init_margin + * + * @return string|null + */ + public function getInitMargin() + { + return $this->container['init_margin']; + } + + /** + * Sets init_margin + * + * @param string|null $init_margin Initial position margin + * + * @return $this + */ + public function setInitMargin($init_margin) + { + $this->container['init_margin'] = $init_margin; + + return $this; + } + + /** + * Gets maint_margin + * + * @return string|null + */ + public function getMaintMargin() + { + return $this->container['maint_margin']; + } + + /** + * Sets maint_margin + * + * @param string|null $maint_margin Position maintenance margin + * + * @return $this + */ + public function setMaintMargin($maint_margin) + { + $this->container['maint_margin'] = $maint_margin; + + return $this; + } + + /** + * Gets order_margin + * + * @return string|null + */ + public function getOrderMargin() + { + return $this->container['order_margin']; + } + + /** + * Sets order_margin + * + * @param string|null $order_margin Order margin of unfinished orders + * + * @return $this + */ + public function setOrderMargin($order_margin) + { + $this->container['order_margin'] = $order_margin; + + return $this; + } + + /** + * Gets available + * + * @return string|null + */ + public function getAvailable() + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param string|null $available Available balance to transfer out or trade + * + * @return $this + */ + public function setAvailable($available) + { + $this->container['available'] = $available; + + return $this; + } + + /** + * Gets point + * + * @return string|null + */ + public function getPoint() + { + return $this->container['point']; + } + + /** + * Sets point + * + * @param string|null $point POINT amount + * + * @return $this + */ + public function setPoint($point) + { + $this->container['point'] = $point; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Settle currency + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsAccountBook.php b/src/Model/OptionsAccountBook.php new file mode 100644 index 0000000..d7c4ca6 --- /dev/null +++ b/src/Model/OptionsAccountBook.php @@ -0,0 +1,425 @@ + 'double', + 'change' => 'string', + 'balance' => 'string', + 'type' => 'string', + 'text' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'time' => 'double', + 'change' => null, + 'balance' => null, + 'type' => null, + 'text' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time' => 'time', + 'change' => 'change', + 'balance' => 'balance', + 'type' => 'type', + 'text' => 'text' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time' => 'setTime', + 'change' => 'setChange', + 'balance' => 'setBalance', + 'type' => 'setType', + 'text' => 'setText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time' => 'getTime', + 'change' => 'getChange', + 'balance' => 'getBalance', + 'type' => 'getType', + 'text' => 'getText' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['change'] = isset($data['change']) ? $data['change'] : null; + $this->container['balance'] = isset($data['balance']) ? $data['balance'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['text'] = isset($data['text']) ? $data['text'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 time + * + * @return double|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param double|null $time Change time + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets change + * + * @return string|null + */ + public function getChange() + { + return $this->container['change']; + } + + /** + * Sets change + * + * @param string|null $change Amount changed (USDT) + * + * @return $this + */ + public function setChange($change) + { + $this->container['change'] = $change; + + return $this; + } + + /** + * Gets balance + * + * @return string|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param string|null $balance Account total balance after change (USDT) + * + * @return $this + */ + public function setBalance($balance) + { + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + * + * @return $this + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text custom text + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsCandlestick.php b/src/Model/OptionsCandlestick.php new file mode 100644 index 0000000..ddf7e65 --- /dev/null +++ b/src/Model/OptionsCandlestick.php @@ -0,0 +1,456 @@ + 'double', + 'v' => 'int', + 'c' => 'string', + 'h' => 'string', + 'l' => 'string', + 'o' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 't' => 'double', + 'v' => 'int64', + 'c' => null, + 'h' => null, + 'l' => null, + 'o' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 't' => 't', + 'v' => 'v', + 'c' => 'c', + 'h' => 'h', + 'l' => 'l', + 'o' => 'o' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 't' => 'setT', + 'v' => 'setV', + 'c' => 'setC', + 'h' => 'setH', + 'l' => 'setL', + 'o' => 'setO' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 't' => 'getT', + 'v' => 'getV', + 'c' => 'getC', + 'h' => 'getH', + 'l' => 'getL', + 'o' => 'getO' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['t'] = isset($data['t']) ? $data['t'] : null; + $this->container['v'] = isset($data['v']) ? $data['v'] : null; + $this->container['c'] = isset($data['c']) ? $data['c'] : null; + $this->container['h'] = isset($data['h']) ? $data['h'] : null; + $this->container['l'] = isset($data['l']) ? $data['l'] : null; + $this->container['o'] = isset($data['o']) ? $data['o'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 t + * + * @return double|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param double|null $t Unix timestamp in seconds + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + + /** + * Gets v + * + * @return int|null + */ + public function getV() + { + return $this->container['v']; + } + + /** + * Sets v + * + * @param int|null $v size volume (contract size). Only returned if `contract` is not prefixed + * + * @return $this + */ + public function setV($v) + { + $this->container['v'] = $v; + + return $this; + } + + /** + * Gets c + * + * @return string|null + */ + public function getC() + { + return $this->container['c']; + } + + /** + * Sets c + * + * @param string|null $c Close price (quote currency, unit: underlying corresponding option price) + * + * @return $this + */ + public function setC($c) + { + $this->container['c'] = $c; + + return $this; + } + + /** + * Gets h + * + * @return string|null + */ + public function getH() + { + return $this->container['h']; + } + + /** + * Sets h + * + * @param string|null $h Highest price (quote currency, unit: underlying corresponding option price) + * + * @return $this + */ + public function setH($h) + { + $this->container['h'] = $h; + + return $this; + } + + /** + * Gets l + * + * @return string|null + */ + public function getL() + { + return $this->container['l']; + } + + /** + * Sets l + * + * @param string|null $l Lowest price (quote currency, unit: underlying corresponding option price) + * + * @return $this + */ + public function setL($l) + { + $this->container['l'] = $l; + + return $this; + } + + /** + * Gets o + * + * @return string|null + */ + public function getO() + { + return $this->container['o']; + } + + /** + * Sets o + * + * @param string|null $o Open price (quote currency, unit: underlying corresponding option price) + * + * @return $this + */ + public function setO($o) + { + $this->container['o'] = $o; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsContract.php b/src/Model/OptionsContract.php new file mode 100644 index 0000000..39fd393 --- /dev/null +++ b/src/Model/OptionsContract.php @@ -0,0 +1,1026 @@ + 'string', + 'tag' => 'string', + 'create_time' => 'double', + 'expiration_time' => 'double', + 'is_call' => 'bool', + 'multiplier' => 'string', + 'underlying' => 'string', + 'underlying_price' => 'string', + 'last_price' => 'string', + 'mark_price' => 'string', + 'index_price' => 'string', + 'maker_fee_rate' => 'string', + 'taker_fee_rate' => 'string', + 'order_price_round' => 'string', + 'mark_price_round' => 'string', + 'order_size_min' => 'int', + 'order_size_max' => 'int', + 'order_price_deviate' => 'string', + 'ref_discount_rate' => 'string', + 'ref_rebate_rate' => 'string', + 'orderbook_id' => 'int', + 'trade_id' => 'int', + 'trade_size' => 'int', + 'position_size' => 'int', + 'orders_limit' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tag' => null, + 'create_time' => 'double', + 'expiration_time' => 'double', + 'is_call' => null, + 'multiplier' => null, + 'underlying' => null, + 'underlying_price' => null, + 'last_price' => null, + 'mark_price' => null, + 'index_price' => null, + 'maker_fee_rate' => null, + 'taker_fee_rate' => null, + 'order_price_round' => null, + 'mark_price_round' => null, + 'order_size_min' => 'int64', + 'order_size_max' => 'int64', + 'order_price_deviate' => null, + 'ref_discount_rate' => null, + 'ref_rebate_rate' => null, + 'orderbook_id' => 'int64', + 'trade_id' => 'int64', + 'trade_size' => 'int64', + 'position_size' => 'int64', + 'orders_limit' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'tag' => 'tag', + 'create_time' => 'create_time', + 'expiration_time' => 'expiration_time', + 'is_call' => 'is_call', + 'multiplier' => 'multiplier', + 'underlying' => 'underlying', + 'underlying_price' => 'underlying_price', + 'last_price' => 'last_price', + 'mark_price' => 'mark_price', + 'index_price' => 'index_price', + 'maker_fee_rate' => 'maker_fee_rate', + 'taker_fee_rate' => 'taker_fee_rate', + 'order_price_round' => 'order_price_round', + 'mark_price_round' => 'mark_price_round', + 'order_size_min' => 'order_size_min', + 'order_size_max' => 'order_size_max', + 'order_price_deviate' => 'order_price_deviate', + 'ref_discount_rate' => 'ref_discount_rate', + 'ref_rebate_rate' => 'ref_rebate_rate', + 'orderbook_id' => 'orderbook_id', + 'trade_id' => 'trade_id', + 'trade_size' => 'trade_size', + 'position_size' => 'position_size', + 'orders_limit' => 'orders_limit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tag' => 'setTag', + 'create_time' => 'setCreateTime', + 'expiration_time' => 'setExpirationTime', + 'is_call' => 'setIsCall', + 'multiplier' => 'setMultiplier', + 'underlying' => 'setUnderlying', + 'underlying_price' => 'setUnderlyingPrice', + 'last_price' => 'setLastPrice', + 'mark_price' => 'setMarkPrice', + 'index_price' => 'setIndexPrice', + 'maker_fee_rate' => 'setMakerFeeRate', + 'taker_fee_rate' => 'setTakerFeeRate', + 'order_price_round' => 'setOrderPriceRound', + 'mark_price_round' => 'setMarkPriceRound', + 'order_size_min' => 'setOrderSizeMin', + 'order_size_max' => 'setOrderSizeMax', + 'order_price_deviate' => 'setOrderPriceDeviate', + 'ref_discount_rate' => 'setRefDiscountRate', + 'ref_rebate_rate' => 'setRefRebateRate', + 'orderbook_id' => 'setOrderbookId', + 'trade_id' => 'setTradeId', + 'trade_size' => 'setTradeSize', + 'position_size' => 'setPositionSize', + 'orders_limit' => 'setOrdersLimit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tag' => 'getTag', + 'create_time' => 'getCreateTime', + 'expiration_time' => 'getExpirationTime', + 'is_call' => 'getIsCall', + 'multiplier' => 'getMultiplier', + 'underlying' => 'getUnderlying', + 'underlying_price' => 'getUnderlyingPrice', + 'last_price' => 'getLastPrice', + 'mark_price' => 'getMarkPrice', + 'index_price' => 'getIndexPrice', + 'maker_fee_rate' => 'getMakerFeeRate', + 'taker_fee_rate' => 'getTakerFeeRate', + 'order_price_round' => 'getOrderPriceRound', + 'mark_price_round' => 'getMarkPriceRound', + 'order_size_min' => 'getOrderSizeMin', + 'order_size_max' => 'getOrderSizeMax', + 'order_price_deviate' => 'getOrderPriceDeviate', + 'ref_discount_rate' => 'getRefDiscountRate', + 'ref_rebate_rate' => 'getRefRebateRate', + 'orderbook_id' => 'getOrderbookId', + 'trade_id' => 'getTradeId', + 'trade_size' => 'getTradeSize', + 'position_size' => 'getPositionSize', + 'orders_limit' => 'getOrdersLimit' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; + $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; + $this->container['expiration_time'] = isset($data['expiration_time']) ? $data['expiration_time'] : null; + $this->container['is_call'] = isset($data['is_call']) ? $data['is_call'] : null; + $this->container['multiplier'] = isset($data['multiplier']) ? $data['multiplier'] : null; + $this->container['underlying'] = isset($data['underlying']) ? $data['underlying'] : null; + $this->container['underlying_price'] = isset($data['underlying_price']) ? $data['underlying_price'] : null; + $this->container['last_price'] = isset($data['last_price']) ? $data['last_price'] : null; + $this->container['mark_price'] = isset($data['mark_price']) ? $data['mark_price'] : null; + $this->container['index_price'] = isset($data['index_price']) ? $data['index_price'] : null; + $this->container['maker_fee_rate'] = isset($data['maker_fee_rate']) ? $data['maker_fee_rate'] : null; + $this->container['taker_fee_rate'] = isset($data['taker_fee_rate']) ? $data['taker_fee_rate'] : null; + $this->container['order_price_round'] = isset($data['order_price_round']) ? $data['order_price_round'] : null; + $this->container['mark_price_round'] = isset($data['mark_price_round']) ? $data['mark_price_round'] : null; + $this->container['order_size_min'] = isset($data['order_size_min']) ? $data['order_size_min'] : null; + $this->container['order_size_max'] = isset($data['order_size_max']) ? $data['order_size_max'] : null; + $this->container['order_price_deviate'] = isset($data['order_price_deviate']) ? $data['order_price_deviate'] : null; + $this->container['ref_discount_rate'] = isset($data['ref_discount_rate']) ? $data['ref_discount_rate'] : null; + $this->container['ref_rebate_rate'] = isset($data['ref_rebate_rate']) ? $data['ref_rebate_rate'] : null; + $this->container['orderbook_id'] = isset($data['orderbook_id']) ? $data['orderbook_id'] : null; + $this->container['trade_id'] = isset($data['trade_id']) ? $data['trade_id'] : null; + $this->container['trade_size'] = isset($data['trade_size']) ? $data['trade_size'] : null; + $this->container['position_size'] = isset($data['position_size']) ? $data['position_size'] : null; + $this->container['orders_limit'] = isset($data['orders_limit']) ? $data['orders_limit'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Options contract name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag() + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag tag + * + * @return $this + */ + public function setTag($tag) + { + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets create_time + * + * @return double|null + */ + public function getCreateTime() + { + return $this->container['create_time']; + } + + /** + * Sets create_time + * + * @param double|null $create_time Creation time + * + * @return $this + */ + public function setCreateTime($create_time) + { + $this->container['create_time'] = $create_time; + + return $this; + } + + /** + * Gets expiration_time + * + * @return double|null + */ + public function getExpirationTime() + { + return $this->container['expiration_time']; + } + + /** + * Sets expiration_time + * + * @param double|null $expiration_time Expiration time + * + * @return $this + */ + public function setExpirationTime($expiration_time) + { + $this->container['expiration_time'] = $expiration_time; + + return $this; + } + + /** + * Gets is_call + * + * @return bool|null + */ + public function getIsCall() + { + return $this->container['is_call']; + } + + /** + * Sets is_call + * + * @param bool|null $is_call `true` means call options, while `false` is put options + * + * @return $this + */ + public function setIsCall($is_call) + { + $this->container['is_call'] = $is_call; + + return $this; + } + + /** + * Gets multiplier + * + * @return string|null + */ + public function getMultiplier() + { + return $this->container['multiplier']; + } + + /** + * Sets multiplier + * + * @param string|null $multiplier Multiplier used in converting from invoicing to settlement currency + * + * @return $this + */ + public function setMultiplier($multiplier) + { + $this->container['multiplier'] = $multiplier; + + return $this; + } + + /** + * Gets underlying + * + * @return string|null + */ + public function getUnderlying() + { + return $this->container['underlying']; + } + + /** + * Sets underlying + * + * @param string|null $underlying Underlying + * + * @return $this + */ + public function setUnderlying($underlying) + { + $this->container['underlying'] = $underlying; + + return $this; + } + + /** + * Gets underlying_price + * + * @return string|null + */ + public function getUnderlyingPrice() + { + return $this->container['underlying_price']; + } + + /** + * Sets underlying_price + * + * @param string|null $underlying_price Underlying price (quote currency) + * + * @return $this + */ + public function setUnderlyingPrice($underlying_price) + { + $this->container['underlying_price'] = $underlying_price; + + return $this; + } + + /** + * Gets last_price + * + * @return string|null + */ + public function getLastPrice() + { + return $this->container['last_price']; + } + + /** + * Sets last_price + * + * @param string|null $last_price Last trading price + * + * @return $this + */ + public function setLastPrice($last_price) + { + $this->container['last_price'] = $last_price; + + return $this; + } + + /** + * Gets mark_price + * + * @return string|null + */ + public function getMarkPrice() + { + return $this->container['mark_price']; + } + + /** + * Sets mark_price + * + * @param string|null $mark_price Current mark price (quote currency) + * + * @return $this + */ + public function setMarkPrice($mark_price) + { + $this->container['mark_price'] = $mark_price; + + return $this; + } + + /** + * Gets index_price + * + * @return string|null + */ + public function getIndexPrice() + { + return $this->container['index_price']; + } + + /** + * Sets index_price + * + * @param string|null $index_price Current index price (quote currency) + * + * @return $this + */ + public function setIndexPrice($index_price) + { + $this->container['index_price'] = $index_price; + + return $this; + } + + /** + * Gets maker_fee_rate + * + * @return string|null + */ + public function getMakerFeeRate() + { + return $this->container['maker_fee_rate']; + } + + /** + * Sets maker_fee_rate + * + * @param string|null $maker_fee_rate Maker fee rate, where negative means rebate + * + * @return $this + */ + public function setMakerFeeRate($maker_fee_rate) + { + $this->container['maker_fee_rate'] = $maker_fee_rate; + + return $this; + } + + /** + * Gets taker_fee_rate + * + * @return string|null + */ + public function getTakerFeeRate() + { + return $this->container['taker_fee_rate']; + } + + /** + * Sets taker_fee_rate + * + * @param string|null $taker_fee_rate Taker fee rate + * + * @return $this + */ + public function setTakerFeeRate($taker_fee_rate) + { + $this->container['taker_fee_rate'] = $taker_fee_rate; + + return $this; + } + + /** + * Gets order_price_round + * + * @return string|null + */ + public function getOrderPriceRound() + { + return $this->container['order_price_round']; + } + + /** + * Sets order_price_round + * + * @param string|null $order_price_round Minimum order price increment + * + * @return $this + */ + public function setOrderPriceRound($order_price_round) + { + $this->container['order_price_round'] = $order_price_round; + + return $this; + } + + /** + * Gets mark_price_round + * + * @return string|null + */ + public function getMarkPriceRound() + { + return $this->container['mark_price_round']; + } + + /** + * Sets mark_price_round + * + * @param string|null $mark_price_round Minimum mark price increment + * + * @return $this + */ + public function setMarkPriceRound($mark_price_round) + { + $this->container['mark_price_round'] = $mark_price_round; + + return $this; + } + + /** + * Gets order_size_min + * + * @return int|null + */ + public function getOrderSizeMin() + { + return $this->container['order_size_min']; + } + + /** + * Sets order_size_min + * + * @param int|null $order_size_min Minimum order size the contract allowed + * + * @return $this + */ + public function setOrderSizeMin($order_size_min) + { + $this->container['order_size_min'] = $order_size_min; + + return $this; + } + + /** + * Gets order_size_max + * + * @return int|null + */ + public function getOrderSizeMax() + { + return $this->container['order_size_max']; + } + + /** + * Sets order_size_max + * + * @param int|null $order_size_max Maximum order size the contract allowed + * + * @return $this + */ + public function setOrderSizeMax($order_size_max) + { + $this->container['order_size_max'] = $order_size_max; + + return $this; + } + + /** + * Gets order_price_deviate + * + * @return string|null + */ + public function getOrderPriceDeviate() + { + return $this->container['order_price_deviate']; + } + + /** + * Sets order_price_deviate + * + * @param string|null $order_price_deviate deviation between order price and current index price. If price of an order is denoted as order_price, it must meet the following condition: abs(order_price - mark_price) <= mark_price * order_price_deviate + * + * @return $this + */ + public function setOrderPriceDeviate($order_price_deviate) + { + $this->container['order_price_deviate'] = $order_price_deviate; + + return $this; + } + + /** + * Gets ref_discount_rate + * + * @return string|null + */ + public function getRefDiscountRate() + { + return $this->container['ref_discount_rate']; + } + + /** + * Sets ref_discount_rate + * + * @param string|null $ref_discount_rate Referral fee rate discount + * + * @return $this + */ + public function setRefDiscountRate($ref_discount_rate) + { + $this->container['ref_discount_rate'] = $ref_discount_rate; + + return $this; + } + + /** + * Gets ref_rebate_rate + * + * @return string|null + */ + public function getRefRebateRate() + { + return $this->container['ref_rebate_rate']; + } + + /** + * Sets ref_rebate_rate + * + * @param string|null $ref_rebate_rate Referrer commission rate + * + * @return $this + */ + public function setRefRebateRate($ref_rebate_rate) + { + $this->container['ref_rebate_rate'] = $ref_rebate_rate; + + return $this; + } + + /** + * Gets orderbook_id + * + * @return int|null + */ + public function getOrderbookId() + { + return $this->container['orderbook_id']; + } + + /** + * Sets orderbook_id + * + * @param int|null $orderbook_id Current orderbook ID + * + * @return $this + */ + public function setOrderbookId($orderbook_id) + { + $this->container['orderbook_id'] = $orderbook_id; + + return $this; + } + + /** + * Gets trade_id + * + * @return int|null + */ + public function getTradeId() + { + return $this->container['trade_id']; + } + + /** + * Sets trade_id + * + * @param int|null $trade_id Current trade ID + * + * @return $this + */ + public function setTradeId($trade_id) + { + $this->container['trade_id'] = $trade_id; + + return $this; + } + + /** + * Gets trade_size + * + * @return int|null + */ + public function getTradeSize() + { + return $this->container['trade_size']; + } + + /** + * Sets trade_size + * + * @param int|null $trade_size Historical accumulated trade size + * + * @return $this + */ + public function setTradeSize($trade_size) + { + $this->container['trade_size'] = $trade_size; + + return $this; + } + + /** + * Gets position_size + * + * @return int|null + */ + public function getPositionSize() + { + return $this->container['position_size']; + } + + /** + * Sets position_size + * + * @param int|null $position_size Current total long position size + * + * @return $this + */ + public function setPositionSize($position_size) + { + $this->container['position_size'] = $position_size; + + return $this; + } + + /** + * Gets orders_limit + * + * @return int|null + */ + public function getOrdersLimit() + { + return $this->container['orders_limit']; + } + + /** + * Sets orders_limit + * + * @param int|null $orders_limit Maximum number of open orders + * + * @return $this + */ + public function setOrdersLimit($orders_limit) + { + $this->container['orders_limit'] = $orders_limit; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsMySettlements.php b/src/Model/OptionsMySettlements.php new file mode 100644 index 0000000..644cfaf --- /dev/null +++ b/src/Model/OptionsMySettlements.php @@ -0,0 +1,545 @@ + 'double', + 'underlying' => 'string', + 'contract' => 'string', + 'strike_price' => 'string', + 'settle_price' => 'string', + 'size' => 'int', + 'settle_profit' => 'string', + 'fee' => 'string', + 'realised_pnl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'time' => 'double', + 'underlying' => null, + 'contract' => null, + 'strike_price' => null, + 'settle_price' => null, + 'size' => 'int64', + 'settle_profit' => null, + 'fee' => null, + 'realised_pnl' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time' => 'time', + 'underlying' => 'underlying', + 'contract' => 'contract', + 'strike_price' => 'strike_price', + 'settle_price' => 'settle_price', + 'size' => 'size', + 'settle_profit' => 'settle_profit', + 'fee' => 'fee', + 'realised_pnl' => 'realised_pnl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time' => 'setTime', + 'underlying' => 'setUnderlying', + 'contract' => 'setContract', + 'strike_price' => 'setStrikePrice', + 'settle_price' => 'setSettlePrice', + 'size' => 'setSize', + 'settle_profit' => 'setSettleProfit', + 'fee' => 'setFee', + 'realised_pnl' => 'setRealisedPnl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time' => 'getTime', + 'underlying' => 'getUnderlying', + 'contract' => 'getContract', + 'strike_price' => 'getStrikePrice', + 'settle_price' => 'getSettlePrice', + 'size' => 'getSize', + 'settle_profit' => 'getSettleProfit', + 'fee' => 'getFee', + 'realised_pnl' => 'getRealisedPnl' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['underlying'] = isset($data['underlying']) ? $data['underlying'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['strike_price'] = isset($data['strike_price']) ? $data['strike_price'] : null; + $this->container['settle_price'] = isset($data['settle_price']) ? $data['settle_price'] : null; + $this->container['size'] = isset($data['size']) ? $data['size'] : null; + $this->container['settle_profit'] = isset($data['settle_profit']) ? $data['settle_profit'] : null; + $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; + $this->container['realised_pnl'] = isset($data['realised_pnl']) ? $data['realised_pnl'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 time + * + * @return double|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param double|null $time Settlement time + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets underlying + * + * @return string|null + */ + public function getUnderlying() + { + return $this->container['underlying']; + } + + /** + * Sets underlying + * + * @param string|null $underlying Underlying + * + * @return $this + */ + public function setUnderlying($underlying) + { + $this->container['underlying'] = $underlying; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Options contract name + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets strike_price + * + * @return string|null + */ + public function getStrikePrice() + { + return $this->container['strike_price']; + } + + /** + * Sets strike_price + * + * @param string|null $strike_price Strike price (quote currency) + * + * @return $this + */ + public function setStrikePrice($strike_price) + { + $this->container['strike_price'] = $strike_price; + + return $this; + } + + /** + * Gets settle_price + * + * @return string|null + */ + public function getSettlePrice() + { + return $this->container['settle_price']; + } + + /** + * Sets settle_price + * + * @param string|null $settle_price Settlement price (quote currency) + * + * @return $this + */ + public function setSettlePrice($settle_price) + { + $this->container['settle_price'] = $settle_price; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size Size + * + * @return $this + */ + public function setSize($size) + { + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets settle_profit + * + * @return string|null + */ + public function getSettleProfit() + { + return $this->container['settle_profit']; + } + + /** + * Sets settle_profit + * + * @param string|null $settle_profit Settlement profit (quote currency) + * + * @return $this + */ + public function setSettleProfit($settle_profit) + { + $this->container['settle_profit'] = $settle_profit; + + return $this; + } + + /** + * Gets fee + * + * @return string|null + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param string|null $fee Fee (quote currency) + * + * @return $this + */ + public function setFee($fee) + { + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets realised_pnl + * + * @return string|null + */ + public function getRealisedPnl() + { + return $this->container['realised_pnl']; + } + + /** + * Sets realised_pnl + * + * @param string|null $realised_pnl The accumulated profit and loss of opening a position, including premium, fee, settlement profit, etc. (quote currency) + * + * @return $this + */ + public function setRealisedPnl($realised_pnl) + { + $this->container['realised_pnl'] = $realised_pnl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsMyTrade.php b/src/Model/OptionsMyTrade.php new file mode 100644 index 0000000..e767f96 --- /dev/null +++ b/src/Model/OptionsMyTrade.php @@ -0,0 +1,547 @@ + 'int', + 'create_time' => 'double', + 'contract' => 'string', + 'order_id' => 'int', + 'size' => 'int', + 'price' => 'string', + 'underlying_price' => 'string', + 'role' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'create_time' => 'double', + 'contract' => null, + 'order_id' => null, + 'size' => 'int64', + 'price' => null, + 'underlying_price' => null, + 'role' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'create_time' => 'create_time', + 'contract' => 'contract', + 'order_id' => 'order_id', + 'size' => 'size', + 'price' => 'price', + 'underlying_price' => 'underlying_price', + 'role' => 'role' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'create_time' => 'setCreateTime', + 'contract' => 'setContract', + 'order_id' => 'setOrderId', + 'size' => 'setSize', + 'price' => 'setPrice', + 'underlying_price' => 'setUnderlyingPrice', + 'role' => 'setRole' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'create_time' => 'getCreateTime', + 'contract' => 'getContract', + 'order_id' => 'getOrderId', + 'size' => 'getSize', + 'price' => 'getPrice', + 'underlying_price' => 'getUnderlyingPrice', + 'role' => 'getRole' + ]; + + /** + * 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::$openAPIModelName; + } + + const ROLE_TAKER = 'taker'; + const ROLE_MAKER = 'maker'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRoleAllowableValues() + { + return [ + self::ROLE_TAKER, + self::ROLE_MAKER, + ]; + } + + + /** + * 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['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['order_id'] = isset($data['order_id']) ? $data['order_id'] : null; + $this->container['size'] = isset($data['size']) ? $data['size'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['underlying_price'] = isset($data['underlying_price']) ? $data['underlying_price'] : null; + $this->container['role'] = isset($data['role']) ? $data['role'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getRoleAllowableValues(); + if (!is_null($this->container['role']) && !in_array($this->container['role'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'role', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Trade ID + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets create_time + * + * @return double|null + */ + public function getCreateTime() + { + return $this->container['create_time']; + } + + /** + * Sets create_time + * + * @param double|null $create_time Trading time + * + * @return $this + */ + public function setCreateTime($create_time) + { + $this->container['create_time'] = $create_time; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Options contract name + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets order_id + * + * @return int|null + */ + public function getOrderId() + { + return $this->container['order_id']; + } + + /** + * Sets order_id + * + * @param int|null $order_id Order ID related + * + * @return $this + */ + public function setOrderId($order_id) + { + $this->container['order_id'] = $order_id; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size Trading size + * + * @return $this + */ + public function setSize($size) + { + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Trading price (quote currency) + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets underlying_price + * + * @return string|null + */ + public function getUnderlyingPrice() + { + return $this->container['underlying_price']; + } + + /** + * Sets underlying_price + * + * @param string|null $underlying_price Underlying price (quote currency) + * + * @return $this + */ + public function setUnderlyingPrice($underlying_price) + { + $this->container['underlying_price'] = $underlying_price; + + return $this; + } + + /** + * Gets role + * + * @return string|null + */ + public function getRole() + { + return $this->container['role']; + } + + /** + * Sets role + * + * @param string|null $role Trade role. Available values are `taker` and `maker` + * + * @return $this + */ + public function setRole($role) + { + $allowedValues = $this->getRoleAllowableValues(); + if (!is_null($role) && !in_array($role, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'role', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['role'] = $role; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsOrder.php b/src/Model/OptionsOrder.php new file mode 100644 index 0000000..b8f4c16 --- /dev/null +++ b/src/Model/OptionsOrder.php @@ -0,0 +1,1082 @@ + 'int', + 'user' => 'int', + 'create_time' => 'double', + 'finish_time' => 'double', + 'finish_as' => 'string', + 'status' => 'string', + 'contract' => 'string', + 'size' => 'int', + 'iceberg' => 'int', + 'price' => 'string', + 'close' => 'bool', + 'is_close' => 'bool', + 'reduce_only' => 'bool', + 'is_reduce_only' => 'bool', + 'is_liq' => 'bool', + 'tif' => 'string', + 'left' => 'int', + 'fill_price' => 'string', + 'text' => 'string', + 'tkfr' => 'string', + 'mkfr' => 'string', + 'refu' => 'int', + 'refr' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'user' => null, + 'create_time' => 'double', + 'finish_time' => 'double', + 'finish_as' => null, + 'status' => null, + 'contract' => null, + 'size' => 'int64', + 'iceberg' => 'int64', + 'price' => null, + 'close' => null, + 'is_close' => null, + 'reduce_only' => null, + 'is_reduce_only' => null, + 'is_liq' => null, + 'tif' => null, + 'left' => 'int64', + 'fill_price' => null, + 'text' => null, + 'tkfr' => null, + 'mkfr' => null, + 'refu' => null, + 'refr' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'user' => 'user', + 'create_time' => 'create_time', + 'finish_time' => 'finish_time', + 'finish_as' => 'finish_as', + 'status' => 'status', + 'contract' => 'contract', + 'size' => 'size', + 'iceberg' => 'iceberg', + 'price' => 'price', + 'close' => 'close', + 'is_close' => 'is_close', + 'reduce_only' => 'reduce_only', + 'is_reduce_only' => 'is_reduce_only', + 'is_liq' => 'is_liq', + 'tif' => 'tif', + 'left' => 'left', + 'fill_price' => 'fill_price', + 'text' => 'text', + 'tkfr' => 'tkfr', + 'mkfr' => 'mkfr', + 'refu' => 'refu', + 'refr' => 'refr' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'user' => 'setUser', + 'create_time' => 'setCreateTime', + 'finish_time' => 'setFinishTime', + 'finish_as' => 'setFinishAs', + 'status' => 'setStatus', + 'contract' => 'setContract', + 'size' => 'setSize', + 'iceberg' => 'setIceberg', + 'price' => 'setPrice', + 'close' => 'setClose', + 'is_close' => 'setIsClose', + 'reduce_only' => 'setReduceOnly', + 'is_reduce_only' => 'setIsReduceOnly', + 'is_liq' => 'setIsLiq', + 'tif' => 'setTif', + 'left' => 'setLeft', + 'fill_price' => 'setFillPrice', + 'text' => 'setText', + 'tkfr' => 'setTkfr', + 'mkfr' => 'setMkfr', + 'refu' => 'setRefu', + 'refr' => 'setRefr' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'user' => 'getUser', + 'create_time' => 'getCreateTime', + 'finish_time' => 'getFinishTime', + 'finish_as' => 'getFinishAs', + 'status' => 'getStatus', + 'contract' => 'getContract', + 'size' => 'getSize', + 'iceberg' => 'getIceberg', + 'price' => 'getPrice', + 'close' => 'getClose', + 'is_close' => 'getIsClose', + 'reduce_only' => 'getReduceOnly', + 'is_reduce_only' => 'getIsReduceOnly', + 'is_liq' => 'getIsLiq', + 'tif' => 'getTif', + 'left' => 'getLeft', + 'fill_price' => 'getFillPrice', + 'text' => 'getText', + 'tkfr' => 'getTkfr', + 'mkfr' => 'getMkfr', + 'refu' => 'getRefu', + 'refr' => 'getRefr' + ]; + + /** + * 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::$openAPIModelName; + } + + const FINISH_AS_FILLED = 'filled'; + const FINISH_AS_CANCELLED = 'cancelled'; + const FINISH_AS_LIQUIDATED = 'liquidated'; + const FINISH_AS_IOC = 'ioc'; + const FINISH_AS_AUTO_DELEVERAGED = 'auto_deleveraged'; + const FINISH_AS_REDUCE_ONLY = 'reduce_only'; + const FINISH_AS_POSITION_CLOSED = 'position_closed'; + const FINISH_AS_REDUCE_OUT = 'reduce_out'; + const STATUS_OPEN = 'open'; + const STATUS_FINISHED = 'finished'; + const TIF_GTC = 'gtc'; + const TIF_IOC = 'ioc'; + const TIF_POC = 'poc'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFinishAsAllowableValues() + { + return [ + self::FINISH_AS_FILLED, + self::FINISH_AS_CANCELLED, + self::FINISH_AS_LIQUIDATED, + self::FINISH_AS_IOC, + self::FINISH_AS_AUTO_DELEVERAGED, + self::FINISH_AS_REDUCE_ONLY, + self::FINISH_AS_POSITION_CLOSED, + self::FINISH_AS_REDUCE_OUT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_OPEN, + self::STATUS_FINISHED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTifAllowableValues() + { + return [ + self::TIF_GTC, + self::TIF_IOC, + self::TIF_POC, + ]; + } + + + /** + * 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['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['user'] = isset($data['user']) ? $data['user'] : null; + $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; + $this->container['finish_time'] = isset($data['finish_time']) ? $data['finish_time'] : null; + $this->container['finish_as'] = isset($data['finish_as']) ? $data['finish_as'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['size'] = isset($data['size']) ? $data['size'] : null; + $this->container['iceberg'] = isset($data['iceberg']) ? $data['iceberg'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['close'] = isset($data['close']) ? $data['close'] : false; + $this->container['is_close'] = isset($data['is_close']) ? $data['is_close'] : null; + $this->container['reduce_only'] = isset($data['reduce_only']) ? $data['reduce_only'] : false; + $this->container['is_reduce_only'] = isset($data['is_reduce_only']) ? $data['is_reduce_only'] : null; + $this->container['is_liq'] = isset($data['is_liq']) ? $data['is_liq'] : null; + $this->container['tif'] = isset($data['tif']) ? $data['tif'] : 'gtc'; + $this->container['left'] = isset($data['left']) ? $data['left'] : null; + $this->container['fill_price'] = isset($data['fill_price']) ? $data['fill_price'] : null; + $this->container['text'] = isset($data['text']) ? $data['text'] : null; + $this->container['tkfr'] = isset($data['tkfr']) ? $data['tkfr'] : null; + $this->container['mkfr'] = isset($data['mkfr']) ? $data['mkfr'] : null; + $this->container['refu'] = isset($data['refu']) ? $data['refu'] : null; + $this->container['refr'] = isset($data['refr']) ? $data['refr'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getFinishAsAllowableValues(); + if (!is_null($this->container['finish_as']) && !in_array($this->container['finish_as'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'finish_as', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'status', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + if ($this->container['contract'] === null) { + $invalidProperties[] = "'contract' can't be null"; + } + if ($this->container['size'] === null) { + $invalidProperties[] = "'size' can't be null"; + } + $allowedValues = $this->getTifAllowableValues(); + if (!is_null($this->container['tif']) && !in_array($this->container['tif'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'tif', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Options order ID + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets user + * + * @return int|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param int|null $user User ID + * + * @return $this + */ + public function setUser($user) + { + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets create_time + * + * @return double|null + */ + public function getCreateTime() + { + return $this->container['create_time']; + } + + /** + * Sets create_time + * + * @param double|null $create_time Creation time of order + * + * @return $this + */ + public function setCreateTime($create_time) + { + $this->container['create_time'] = $create_time; + + return $this; + } + + /** + * Gets finish_time + * + * @return double|null + */ + public function getFinishTime() + { + return $this->container['finish_time']; + } + + /** + * Sets finish_time + * + * @param double|null $finish_time Order finished time. Not returned if order is open + * + * @return $this + */ + public function setFinishTime($finish_time) + { + $this->container['finish_time'] = $finish_time; + + return $this; + } + + /** + * Gets finish_as + * + * @return string|null + */ + public function getFinishAs() + { + return $this->container['finish_as']; + } + + /** + * Sets finish_as + * + * @param string|null $finish_as How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close + * + * @return $this + */ + public function setFinishAs($finish_as) + { + $allowedValues = $this->getFinishAsAllowableValues(); + if (!is_null($finish_as) && !in_array($finish_as, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'finish_as', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['finish_as'] = $finish_as; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Order status - `open`: waiting to be traded - `finished`: finished + * + * @return $this + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'status', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets contract + * + * @return string + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string $contract Contract name + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets size + * + * @return int + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int $size Order size. Specify positive number to make a bid, and negative number to ask + * + * @return $this + */ + public function setSize($size) + { + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets iceberg + * + * @return int|null + */ + public function getIceberg() + { + return $this->container['iceberg']; + } + + /** + * Sets iceberg + * + * @param int|null $iceberg Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size + * + * @return $this + */ + public function setIceberg($iceberg) + { + $this->container['iceberg'] = $iceberg; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Order price. 0 for market order with `tif` set as `ioc` (USDT) + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets close + * + * @return bool|null + */ + public function getClose() + { + return $this->container['close']; + } + + /** + * Sets close + * + * @param bool|null $close Set as `true` to close the position, with `size` set to 0 + * + * @return $this + */ + public function setClose($close) + { + $this->container['close'] = $close; + + return $this; + } + + /** + * Gets is_close + * + * @return bool|null + */ + public function getIsClose() + { + return $this->container['is_close']; + } + + /** + * Sets is_close + * + * @param bool|null $is_close Is the order to close position + * + * @return $this + */ + public function setIsClose($is_close) + { + $this->container['is_close'] = $is_close; + + return $this; + } + + /** + * Gets reduce_only + * + * @return bool|null + */ + public function getReduceOnly() + { + return $this->container['reduce_only']; + } + + /** + * Sets reduce_only + * + * @param bool|null $reduce_only Set as `true` to be reduce-only order + * + * @return $this + */ + public function setReduceOnly($reduce_only) + { + $this->container['reduce_only'] = $reduce_only; + + return $this; + } + + /** + * Gets is_reduce_only + * + * @return bool|null + */ + public function getIsReduceOnly() + { + return $this->container['is_reduce_only']; + } + + /** + * Sets is_reduce_only + * + * @param bool|null $is_reduce_only Is the order reduce-only + * + * @return $this + */ + public function setIsReduceOnly($is_reduce_only) + { + $this->container['is_reduce_only'] = $is_reduce_only; + + return $this; + } + + /** + * Gets is_liq + * + * @return bool|null + */ + public function getIsLiq() + { + return $this->container['is_liq']; + } + + /** + * Sets is_liq + * + * @param bool|null $is_liq Is the order for liquidation + * + * @return $this + */ + public function setIsLiq($is_liq) + { + $this->container['is_liq'] = $is_liq; + + return $this; + } + + /** + * Gets tif + * + * @return string|null + */ + public function getTif() + { + return $this->container['tif']; + } + + /** + * Sets tif + * + * @param string|null $tif Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee + * + * @return $this + */ + public function setTif($tif) + { + $allowedValues = $this->getTifAllowableValues(); + if (!is_null($tif) && !in_array($tif, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'tif', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['tif'] = $tif; + + return $this; + } + + /** + * Gets left + * + * @return int|null + */ + public function getLeft() + { + return $this->container['left']; + } + + /** + * Sets left + * + * @param int|null $left Size left to be traded + * + * @return $this + */ + public function setLeft($left) + { + $this->container['left'] = $left; + + return $this; + } + + /** + * Gets fill_price + * + * @return string|null + */ + public function getFillPrice() + { + return $this->container['fill_price']; + } + + /** + * Sets fill_price + * + * @param string|null $fill_price Fill price of the order + * + * @return $this + */ + public function setFillPrice($fill_price) + { + $this->container['fill_price'] = $fill_price; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets tkfr + * + * @return string|null + */ + public function getTkfr() + { + return $this->container['tkfr']; + } + + /** + * Sets tkfr + * + * @param string|null $tkfr Taker fee + * + * @return $this + */ + public function setTkfr($tkfr) + { + $this->container['tkfr'] = $tkfr; + + return $this; + } + + /** + * Gets mkfr + * + * @return string|null + */ + public function getMkfr() + { + return $this->container['mkfr']; + } + + /** + * Sets mkfr + * + * @param string|null $mkfr Maker fee + * + * @return $this + */ + public function setMkfr($mkfr) + { + $this->container['mkfr'] = $mkfr; + + return $this; + } + + /** + * Gets refu + * + * @return int|null + */ + public function getRefu() + { + return $this->container['refu']; + } + + /** + * Sets refu + * + * @param int|null $refu Reference user ID + * + * @return $this + */ + public function setRefu($refu) + { + $this->container['refu'] = $refu; + + return $this; + } + + /** + * Gets refr + * + * @return string|null + */ + public function getRefr() + { + return $this->container['refr']; + } + + /** + * Sets refr + * + * @param string|null $refr Referrer rebate + * + * @return $this + */ + public function setRefr($refr) + { + $this->container['refr'] = $refr; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsPosition.php b/src/Model/OptionsPosition.php new file mode 100644 index 0000000..02e4b0b --- /dev/null +++ b/src/Model/OptionsPosition.php @@ -0,0 +1,546 @@ + 'int', + 'contract' => 'string', + 'size' => 'int', + 'entry_price' => 'string', + 'mark_price' => 'string', + 'realised_pnl' => 'string', + 'unrealised_pnl' => 'string', + 'pending_orders' => 'int', + 'close_order' => '\GateApi\Model\OptionsPositionCloseOrder' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'user' => null, + 'contract' => null, + 'size' => 'int64', + 'entry_price' => null, + 'mark_price' => null, + 'realised_pnl' => null, + 'unrealised_pnl' => null, + 'pending_orders' => null, + 'close_order' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user' => 'user', + 'contract' => 'contract', + 'size' => 'size', + 'entry_price' => 'entry_price', + 'mark_price' => 'mark_price', + 'realised_pnl' => 'realised_pnl', + 'unrealised_pnl' => 'unrealised_pnl', + 'pending_orders' => 'pending_orders', + 'close_order' => 'close_order' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user' => 'setUser', + 'contract' => 'setContract', + 'size' => 'setSize', + 'entry_price' => 'setEntryPrice', + 'mark_price' => 'setMarkPrice', + 'realised_pnl' => 'setRealisedPnl', + 'unrealised_pnl' => 'setUnrealisedPnl', + 'pending_orders' => 'setPendingOrders', + 'close_order' => 'setCloseOrder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user' => 'getUser', + 'contract' => 'getContract', + 'size' => 'getSize', + 'entry_price' => 'getEntryPrice', + 'mark_price' => 'getMarkPrice', + 'realised_pnl' => 'getRealisedPnl', + 'unrealised_pnl' => 'getUnrealisedPnl', + 'pending_orders' => 'getPendingOrders', + 'close_order' => 'getCloseOrder' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['user'] = isset($data['user']) ? $data['user'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['size'] = isset($data['size']) ? $data['size'] : null; + $this->container['entry_price'] = isset($data['entry_price']) ? $data['entry_price'] : null; + $this->container['mark_price'] = isset($data['mark_price']) ? $data['mark_price'] : null; + $this->container['realised_pnl'] = isset($data['realised_pnl']) ? $data['realised_pnl'] : null; + $this->container['unrealised_pnl'] = isset($data['unrealised_pnl']) ? $data['unrealised_pnl'] : null; + $this->container['pending_orders'] = isset($data['pending_orders']) ? $data['pending_orders'] : null; + $this->container['close_order'] = isset($data['close_order']) ? $data['close_order'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 user + * + * @return int|null + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param int|null $user User ID + * + * @return $this + */ + public function setUser($user) + { + $this->container['user'] = $user; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Options contract name + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets size + * + * @return int|null + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int|null $size Position size (contract size) + * + * @return $this + */ + public function setSize($size) + { + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets entry_price + * + * @return string|null + */ + public function getEntryPrice() + { + return $this->container['entry_price']; + } + + /** + * Sets entry_price + * + * @param string|null $entry_price Entry size (quote currency) + * + * @return $this + */ + public function setEntryPrice($entry_price) + { + $this->container['entry_price'] = $entry_price; + + return $this; + } + + /** + * Gets mark_price + * + * @return string|null + */ + public function getMarkPrice() + { + return $this->container['mark_price']; + } + + /** + * Sets mark_price + * + * @param string|null $mark_price Current mark price (quote currency) + * + * @return $this + */ + public function setMarkPrice($mark_price) + { + $this->container['mark_price'] = $mark_price; + + return $this; + } + + /** + * Gets realised_pnl + * + * @return string|null + */ + public function getRealisedPnl() + { + return $this->container['realised_pnl']; + } + + /** + * Sets realised_pnl + * + * @param string|null $realised_pnl Realized PNL + * + * @return $this + */ + public function setRealisedPnl($realised_pnl) + { + $this->container['realised_pnl'] = $realised_pnl; + + return $this; + } + + /** + * Gets unrealised_pnl + * + * @return string|null + */ + public function getUnrealisedPnl() + { + return $this->container['unrealised_pnl']; + } + + /** + * Sets unrealised_pnl + * + * @param string|null $unrealised_pnl Unrealized PNL + * + * @return $this + */ + public function setUnrealisedPnl($unrealised_pnl) + { + $this->container['unrealised_pnl'] = $unrealised_pnl; + + return $this; + } + + /** + * Gets pending_orders + * + * @return int|null + */ + public function getPendingOrders() + { + return $this->container['pending_orders']; + } + + /** + * Sets pending_orders + * + * @param int|null $pending_orders Current open orders + * + * @return $this + */ + public function setPendingOrders($pending_orders) + { + $this->container['pending_orders'] = $pending_orders; + + return $this; + } + + /** + * Gets close_order + * + * @return \GateApi\Model\OptionsPositionCloseOrder|null + */ + public function getCloseOrder() + { + return $this->container['close_order']; + } + + /** + * Sets close_order + * + * @param \GateApi\Model\OptionsPositionCloseOrder|null $close_order close_order + * + * @return $this + */ + public function setCloseOrder($close_order) + { + $this->container['close_order'] = $close_order; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsPositionClose.php b/src/Model/OptionsPositionClose.php new file mode 100644 index 0000000..c7fcde3 --- /dev/null +++ b/src/Model/OptionsPositionClose.php @@ -0,0 +1,487 @@ + 'double', + 'contract' => 'string', + 'side' => 'string', + 'pnl' => 'string', + 'text' => 'string', + 'settle_size' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'time' => 'double', + 'contract' => null, + 'side' => null, + 'pnl' => null, + 'text' => null, + 'settle_size' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time' => 'time', + 'contract' => 'contract', + 'side' => 'side', + 'pnl' => 'pnl', + 'text' => 'text', + 'settle_size' => 'settle_size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time' => 'setTime', + 'contract' => 'setContract', + 'side' => 'setSide', + 'pnl' => 'setPnl', + 'text' => 'setText', + 'settle_size' => 'setSettleSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time' => 'getTime', + 'contract' => 'getContract', + 'side' => 'getSide', + 'pnl' => 'getPnl', + 'text' => 'getText', + 'settle_size' => 'getSettleSize' + ]; + + /** + * 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::$openAPIModelName; + } + + const SIDE_LONG = 'long'; + const SIDE_SHORT = 'short'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSideAllowableValues() + { + return [ + self::SIDE_LONG, + self::SIDE_SHORT, + ]; + } + + + /** + * 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['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['side'] = isset($data['side']) ? $data['side'] : null; + $this->container['pnl'] = isset($data['pnl']) ? $data['pnl'] : null; + $this->container['text'] = isset($data['text']) ? $data['text'] : null; + $this->container['settle_size'] = isset($data['settle_size']) ? $data['settle_size'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getSideAllowableValues(); + if (!is_null($this->container['side']) && !in_array($this->container['side'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'side', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + 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 time + * + * @return double|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param double|null $time Position close time + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Options contract name + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets side + * + * @return string|null + */ + public function getSide() + { + return $this->container['side']; + } + + /** + * Sets side + * + * @param string|null $side Position side, long or short + * + * @return $this + */ + public function setSide($side) + { + $allowedValues = $this->getSideAllowableValues(); + if (!is_null($side) && !in_array($side, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'side', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['side'] = $side; + + return $this; + } + + /** + * Gets pnl + * + * @return string|null + */ + public function getPnl() + { + return $this->container['pnl']; + } + + /** + * Sets pnl + * + * @param string|null $pnl PNL + * + * @return $this + */ + public function setPnl($pnl) + { + $this->container['pnl'] = $pnl; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text Text of close order + * + * @return $this + */ + public function setText($text) + { + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets settle_size + * + * @return string|null + */ + public function getSettleSize() + { + return $this->container['settle_size']; + } + + /** + * Sets settle_size + * + * @param string|null $settle_size settlement size + * + * @return $this + */ + public function setSettleSize($settle_size) + { + $this->container['settle_size'] = $settle_size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsPositionCloseOrder.php b/src/Model/OptionsPositionCloseOrder.php new file mode 100644 index 0000000..2e081ec --- /dev/null +++ b/src/Model/OptionsPositionCloseOrder.php @@ -0,0 +1,366 @@ + 'int', + 'price' => 'string', + 'is_liq' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'price' => null, + 'is_liq' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'price' => 'price', + 'is_liq' => 'is_liq' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'price' => 'setPrice', + 'is_liq' => 'setIsLiq' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'price' => 'getPrice', + 'is_liq' => 'getIsLiq' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['is_liq'] = isset($data['is_liq']) ? $data['is_liq'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id Close order ID + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Close order price (quote currency) + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets is_liq + * + * @return bool|null + */ + public function getIsLiq() + { + return $this->container['is_liq']; + } + + /** + * Sets is_liq + * + * @param bool|null $is_liq Is the close order from liquidation + * + * @return $this + */ + public function setIsLiq($is_liq) + { + $this->container['is_liq'] = $is_liq; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsSettlement.php b/src/Model/OptionsSettlement.php new file mode 100644 index 0000000..e487601 --- /dev/null +++ b/src/Model/OptionsSettlement.php @@ -0,0 +1,455 @@ + 'double', + 'contract' => 'string', + 'profit' => 'string', + 'fee' => 'string', + 'strike_price' => 'string', + 'settle_price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'time' => 'double', + 'contract' => null, + 'profit' => null, + 'fee' => null, + 'strike_price' => null, + 'settle_price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'time' => 'time', + 'contract' => 'contract', + 'profit' => 'profit', + 'fee' => 'fee', + 'strike_price' => 'strike_price', + 'settle_price' => 'settle_price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'time' => 'setTime', + 'contract' => 'setContract', + 'profit' => 'setProfit', + 'fee' => 'setFee', + 'strike_price' => 'setStrikePrice', + 'settle_price' => 'setSettlePrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'time' => 'getTime', + 'contract' => 'getContract', + 'profit' => 'getProfit', + 'fee' => 'getFee', + 'strike_price' => 'getStrikePrice', + 'settle_price' => 'getSettlePrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['contract'] = isset($data['contract']) ? $data['contract'] : null; + $this->container['profit'] = isset($data['profit']) ? $data['profit'] : null; + $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; + $this->container['strike_price'] = isset($data['strike_price']) ? $data['strike_price'] : null; + $this->container['settle_price'] = isset($data['settle_price']) ? $data['settle_price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 time + * + * @return double|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param double|null $time Last changed time of configuration + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets contract + * + * @return string|null + */ + public function getContract() + { + return $this->container['contract']; + } + + /** + * Sets contract + * + * @param string|null $contract Options contract name + * + * @return $this + */ + public function setContract($contract) + { + $this->container['contract'] = $contract; + + return $this; + } + + /** + * Gets profit + * + * @return string|null + */ + public function getProfit() + { + return $this->container['profit']; + } + + /** + * Sets profit + * + * @param string|null $profit Settlement profit per size (quote currency) + * + * @return $this + */ + public function setProfit($profit) + { + $this->container['profit'] = $profit; + + return $this; + } + + /** + * Gets fee + * + * @return string|null + */ + public function getFee() + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param string|null $fee Settlement fee per size (quote currency) + * + * @return $this + */ + public function setFee($fee) + { + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets strike_price + * + * @return string|null + */ + public function getStrikePrice() + { + return $this->container['strike_price']; + } + + /** + * Sets strike_price + * + * @param string|null $strike_price Strike price (quote currency) + * + * @return $this + */ + public function setStrikePrice($strike_price) + { + $this->container['strike_price'] = $strike_price; + + return $this; + } + + /** + * Gets settle_price + * + * @return string|null + */ + public function getSettlePrice() + { + return $this->container['settle_price']; + } + + /** + * Sets settle_price + * + * @param string|null $settle_price Settlement price (quote currency) + * + * @return $this + */ + public function setSettlePrice($settle_price) + { + $this->container['settle_price'] = $settle_price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsTicker.php b/src/Model/OptionsTicker.php new file mode 100644 index 0000000..973c11e --- /dev/null +++ b/src/Model/OptionsTicker.php @@ -0,0 +1,816 @@ + 'string', + 'last_price' => 'string', + 'mark_price' => 'string', + 'index_price' => 'string', + 'ask1_size' => 'int', + 'ask1_price' => 'string', + 'bid1_size' => 'int', + 'bid1_price' => 'string', + 'position_size' => 'int', + 'mark_iv' => 'string', + 'bid_iv' => 'string', + 'ask_iv' => 'string', + 'leverage' => 'string', + 'delta' => 'string', + 'gamma' => 'string', + 'vega' => 'string', + 'theta' => 'string', + 'rho' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'last_price' => null, + 'mark_price' => null, + 'index_price' => null, + 'ask1_size' => 'int64', + 'ask1_price' => null, + 'bid1_size' => 'int64', + 'bid1_price' => null, + 'position_size' => 'int64', + 'mark_iv' => null, + 'bid_iv' => null, + 'ask_iv' => null, + 'leverage' => null, + 'delta' => null, + 'gamma' => null, + 'vega' => null, + 'theta' => null, + 'rho' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'last_price' => 'last_price', + 'mark_price' => 'mark_price', + 'index_price' => 'index_price', + 'ask1_size' => 'ask1_size', + 'ask1_price' => 'ask1_price', + 'bid1_size' => 'bid1_size', + 'bid1_price' => 'bid1_price', + 'position_size' => 'position_size', + 'mark_iv' => 'mark_iv', + 'bid_iv' => 'bid_iv', + 'ask_iv' => 'ask_iv', + 'leverage' => 'leverage', + 'delta' => 'delta', + 'gamma' => 'gamma', + 'vega' => 'vega', + 'theta' => 'theta', + 'rho' => 'rho' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'last_price' => 'setLastPrice', + 'mark_price' => 'setMarkPrice', + 'index_price' => 'setIndexPrice', + 'ask1_size' => 'setAsk1Size', + 'ask1_price' => 'setAsk1Price', + 'bid1_size' => 'setBid1Size', + 'bid1_price' => 'setBid1Price', + 'position_size' => 'setPositionSize', + 'mark_iv' => 'setMarkIv', + 'bid_iv' => 'setBidIv', + 'ask_iv' => 'setAskIv', + 'leverage' => 'setLeverage', + 'delta' => 'setDelta', + 'gamma' => 'setGamma', + 'vega' => 'setVega', + 'theta' => 'setTheta', + 'rho' => 'setRho' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'last_price' => 'getLastPrice', + 'mark_price' => 'getMarkPrice', + 'index_price' => 'getIndexPrice', + 'ask1_size' => 'getAsk1Size', + 'ask1_price' => 'getAsk1Price', + 'bid1_size' => 'getBid1Size', + 'bid1_price' => 'getBid1Price', + 'position_size' => 'getPositionSize', + 'mark_iv' => 'getMarkIv', + 'bid_iv' => 'getBidIv', + 'ask_iv' => 'getAskIv', + 'leverage' => 'getLeverage', + 'delta' => 'getDelta', + 'gamma' => 'getGamma', + 'vega' => 'getVega', + 'theta' => 'getTheta', + 'rho' => 'getRho' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['last_price'] = isset($data['last_price']) ? $data['last_price'] : null; + $this->container['mark_price'] = isset($data['mark_price']) ? $data['mark_price'] : null; + $this->container['index_price'] = isset($data['index_price']) ? $data['index_price'] : null; + $this->container['ask1_size'] = isset($data['ask1_size']) ? $data['ask1_size'] : null; + $this->container['ask1_price'] = isset($data['ask1_price']) ? $data['ask1_price'] : null; + $this->container['bid1_size'] = isset($data['bid1_size']) ? $data['bid1_size'] : null; + $this->container['bid1_price'] = isset($data['bid1_price']) ? $data['bid1_price'] : null; + $this->container['position_size'] = isset($data['position_size']) ? $data['position_size'] : null; + $this->container['mark_iv'] = isset($data['mark_iv']) ? $data['mark_iv'] : null; + $this->container['bid_iv'] = isset($data['bid_iv']) ? $data['bid_iv'] : null; + $this->container['ask_iv'] = isset($data['ask_iv']) ? $data['ask_iv'] : null; + $this->container['leverage'] = isset($data['leverage']) ? $data['leverage'] : null; + $this->container['delta'] = isset($data['delta']) ? $data['delta'] : null; + $this->container['gamma'] = isset($data['gamma']) ? $data['gamma'] : null; + $this->container['vega'] = isset($data['vega']) ? $data['vega'] : null; + $this->container['theta'] = isset($data['theta']) ? $data['theta'] : null; + $this->container['rho'] = isset($data['rho']) ? $data['rho'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Options contract name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets last_price + * + * @return string|null + */ + public function getLastPrice() + { + return $this->container['last_price']; + } + + /** + * Sets last_price + * + * @param string|null $last_price Last trading price (quote currency) + * + * @return $this + */ + public function setLastPrice($last_price) + { + $this->container['last_price'] = $last_price; + + return $this; + } + + /** + * Gets mark_price + * + * @return string|null + */ + public function getMarkPrice() + { + return $this->container['mark_price']; + } + + /** + * Sets mark_price + * + * @param string|null $mark_price Current mark price (quote currency) + * + * @return $this + */ + public function setMarkPrice($mark_price) + { + $this->container['mark_price'] = $mark_price; + + return $this; + } + + /** + * Gets index_price + * + * @return string|null + */ + public function getIndexPrice() + { + return $this->container['index_price']; + } + + /** + * Sets index_price + * + * @param string|null $index_price Current index price (quote currency) + * + * @return $this + */ + public function setIndexPrice($index_price) + { + $this->container['index_price'] = $index_price; + + return $this; + } + + /** + * Gets ask1_size + * + * @return int|null + */ + public function getAsk1Size() + { + return $this->container['ask1_size']; + } + + /** + * Sets ask1_size + * + * @param int|null $ask1_size Best ask size + * + * @return $this + */ + public function setAsk1Size($ask1_size) + { + $this->container['ask1_size'] = $ask1_size; + + return $this; + } + + /** + * Gets ask1_price + * + * @return string|null + */ + public function getAsk1Price() + { + return $this->container['ask1_price']; + } + + /** + * Sets ask1_price + * + * @param string|null $ask1_price Best ask price + * + * @return $this + */ + public function setAsk1Price($ask1_price) + { + $this->container['ask1_price'] = $ask1_price; + + return $this; + } + + /** + * Gets bid1_size + * + * @return int|null + */ + public function getBid1Size() + { + return $this->container['bid1_size']; + } + + /** + * Sets bid1_size + * + * @param int|null $bid1_size Best bid size + * + * @return $this + */ + public function setBid1Size($bid1_size) + { + $this->container['bid1_size'] = $bid1_size; + + return $this; + } + + /** + * Gets bid1_price + * + * @return string|null + */ + public function getBid1Price() + { + return $this->container['bid1_price']; + } + + /** + * Sets bid1_price + * + * @param string|null $bid1_price Best bid price + * + * @return $this + */ + public function setBid1Price($bid1_price) + { + $this->container['bid1_price'] = $bid1_price; + + return $this; + } + + /** + * Gets position_size + * + * @return int|null + */ + public function getPositionSize() + { + return $this->container['position_size']; + } + + /** + * Sets position_size + * + * @param int|null $position_size Current total long position size + * + * @return $this + */ + public function setPositionSize($position_size) + { + $this->container['position_size'] = $position_size; + + return $this; + } + + /** + * Gets mark_iv + * + * @return string|null + */ + public function getMarkIv() + { + return $this->container['mark_iv']; + } + + /** + * Sets mark_iv + * + * @param string|null $mark_iv Implied volatility + * + * @return $this + */ + public function setMarkIv($mark_iv) + { + $this->container['mark_iv'] = $mark_iv; + + return $this; + } + + /** + * Gets bid_iv + * + * @return string|null + */ + public function getBidIv() + { + return $this->container['bid_iv']; + } + + /** + * Sets bid_iv + * + * @param string|null $bid_iv Bid side implied volatility + * + * @return $this + */ + public function setBidIv($bid_iv) + { + $this->container['bid_iv'] = $bid_iv; + + return $this; + } + + /** + * Gets ask_iv + * + * @return string|null + */ + public function getAskIv() + { + return $this->container['ask_iv']; + } + + /** + * Sets ask_iv + * + * @param string|null $ask_iv Ask side implied volatility + * + * @return $this + */ + public function setAskIv($ask_iv) + { + $this->container['ask_iv'] = $ask_iv; + + return $this; + } + + /** + * Gets leverage + * + * @return string|null + */ + public function getLeverage() + { + return $this->container['leverage']; + } + + /** + * Sets leverage + * + * @param string|null $leverage Current leverage. Formula: underlying_price / mark_price * delta + * + * @return $this + */ + public function setLeverage($leverage) + { + $this->container['leverage'] = $leverage; + + return $this; + } + + /** + * Gets delta + * + * @return string|null + */ + public function getDelta() + { + return $this->container['delta']; + } + + /** + * Sets delta + * + * @param string|null $delta Delta + * + * @return $this + */ + public function setDelta($delta) + { + $this->container['delta'] = $delta; + + return $this; + } + + /** + * Gets gamma + * + * @return string|null + */ + public function getGamma() + { + return $this->container['gamma']; + } + + /** + * Sets gamma + * + * @param string|null $gamma Gamma + * + * @return $this + */ + public function setGamma($gamma) + { + $this->container['gamma'] = $gamma; + + return $this; + } + + /** + * Gets vega + * + * @return string|null + */ + public function getVega() + { + return $this->container['vega']; + } + + /** + * Sets vega + * + * @param string|null $vega Vega + * + * @return $this + */ + public function setVega($vega) + { + $this->container['vega'] = $vega; + + return $this; + } + + /** + * Gets theta + * + * @return string|null + */ + public function getTheta() + { + return $this->container['theta']; + } + + /** + * Sets theta + * + * @param string|null $theta Theta + * + * @return $this + */ + public function setTheta($theta) + { + $this->container['theta'] = $theta; + + return $this; + } + + /** + * Gets rho + * + * @return string|null + */ + public function getRho() + { + return $this->container['rho']; + } + + /** + * Sets rho + * + * @param string|null $rho Rho + * + * @return $this + */ + public function setRho($rho) + { + $this->container['rho'] = $rho; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsUnderlying.php b/src/Model/OptionsUnderlying.php new file mode 100644 index 0000000..52a342a --- /dev/null +++ b/src/Model/OptionsUnderlying.php @@ -0,0 +1,335 @@ + 'string', + 'index_price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'index_price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'index_price' => 'index_price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'index_price' => 'setIndexPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'index_price' => 'getIndexPrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['index_price'] = isset($data['index_price']) ? $data['index_price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Underlying name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets index_price + * + * @return string|null + */ + public function getIndexPrice() + { + return $this->container['index_price']; + } + + /** + * Sets index_price + * + * @param string|null $index_price Spot index price (quote currency) + * + * @return $this + */ + public function setIndexPrice($index_price) + { + $this->container['index_price'] = $index_price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OptionsUnderlyingTicker.php b/src/Model/OptionsUnderlyingTicker.php new file mode 100644 index 0000000..a9c673f --- /dev/null +++ b/src/Model/OptionsUnderlyingTicker.php @@ -0,0 +1,366 @@ + 'int', + 'trade_call' => 'int', + 'index_price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'trade_put' => 'int64', + 'trade_call' => 'int64', + 'index_price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'trade_put' => 'trade_put', + 'trade_call' => 'trade_call', + 'index_price' => 'index_price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'trade_put' => 'setTradePut', + 'trade_call' => 'setTradeCall', + 'index_price' => 'setIndexPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'trade_put' => 'getTradePut', + 'trade_call' => 'getTradeCall', + 'index_price' => 'getIndexPrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['trade_put'] = isset($data['trade_put']) ? $data['trade_put'] : null; + $this->container['trade_call'] = isset($data['trade_call']) ? $data['trade_call'] : null; + $this->container['index_price'] = isset($data['index_price']) ? $data['index_price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 trade_put + * + * @return int|null + */ + public function getTradePut() + { + return $this->container['trade_put']; + } + + /** + * Sets trade_put + * + * @param int|null $trade_put Total put options trades amount in last 24h + * + * @return $this + */ + public function setTradePut($trade_put) + { + $this->container['trade_put'] = $trade_put; + + return $this; + } + + /** + * Gets trade_call + * + * @return int|null + */ + public function getTradeCall() + { + return $this->container['trade_call']; + } + + /** + * Sets trade_call + * + * @param int|null $trade_call Total call options trades amount in last 24h + * + * @return $this + */ + public function setTradeCall($trade_call) + { + $this->container['trade_call'] = $trade_call; + + return $this; + } + + /** + * Gets index_price + * + * @return string|null + */ + public function getIndexPrice() + { + return $this->container['index_price']; + } + + /** + * Sets index_price + * + * @param string|null $index_price Index price (quote currency) + * + * @return $this + */ + public function setIndexPrice($index_price) + { + $this->container['index_price'] = $index_price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Order.php b/src/Model/Order.php index a19fb95..9d051a3 100644 --- a/src/Model/Order.php +++ b/src/Model/Order.php @@ -43,17 +43,17 @@ class Order implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Order'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'text' => 'string', @@ -75,20 +75,23 @@ class Order implements ModelInterface, ArrayAccess 'left' => 'string', 'fill_price' => 'string', 'filled_total' => 'string', + 'avg_deal_price' => 'string', 'fee' => 'string', 'fee_currency' => 'string', 'point_fee' => 'string', 'gt_fee' => 'string', + 'gt_maker_fee' => 'string', + 'gt_taker_fee' => 'string', 'gt_discount' => 'bool', 'rebated_fee' => 'string', 'rebated_fee_currency' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'text' => null, @@ -110,10 +113,13 @@ class Order implements ModelInterface, ArrayAccess 'left' => null, 'fill_price' => null, 'filled_total' => null, + 'avg_deal_price' => null, 'fee' => null, 'fee_currency' => null, 'point_fee' => null, 'gt_fee' => null, + 'gt_maker_fee' => null, + 'gt_taker_fee' => null, 'gt_discount' => null, 'rebated_fee' => null, 'rebated_fee_currency' => null @@ -166,10 +172,13 @@ public static function openAPIFormats() 'left' => 'left', 'fill_price' => 'fill_price', 'filled_total' => 'filled_total', + 'avg_deal_price' => 'avg_deal_price', 'fee' => 'fee', 'fee_currency' => 'fee_currency', 'point_fee' => 'point_fee', 'gt_fee' => 'gt_fee', + 'gt_maker_fee' => 'gt_maker_fee', + 'gt_taker_fee' => 'gt_taker_fee', 'gt_discount' => 'gt_discount', 'rebated_fee' => 'rebated_fee', 'rebated_fee_currency' => 'rebated_fee_currency' @@ -201,10 +210,13 @@ public static function openAPIFormats() 'left' => 'setLeft', 'fill_price' => 'setFillPrice', 'filled_total' => 'setFilledTotal', + 'avg_deal_price' => 'setAvgDealPrice', 'fee' => 'setFee', 'fee_currency' => 'setFeeCurrency', 'point_fee' => 'setPointFee', 'gt_fee' => 'setGtFee', + 'gt_maker_fee' => 'setGtMakerFee', + 'gt_taker_fee' => 'setGtTakerFee', 'gt_discount' => 'setGtDiscount', 'rebated_fee' => 'setRebatedFee', 'rebated_fee_currency' => 'setRebatedFeeCurrency' @@ -236,10 +248,13 @@ public static function openAPIFormats() 'left' => 'getLeft', 'fill_price' => 'getFillPrice', 'filled_total' => 'getFilledTotal', + 'avg_deal_price' => 'getAvgDealPrice', 'fee' => 'getFee', 'fee_currency' => 'getFeeCurrency', 'point_fee' => 'getPointFee', 'gt_fee' => 'getGtFee', + 'gt_maker_fee' => 'getGtMakerFee', + 'gt_taker_fee' => 'getGtTakerFee', 'gt_discount' => 'getGtDiscount', 'rebated_fee' => 'getRebatedFee', 'rebated_fee_currency' => 'getRebatedFeeCurrency' @@ -290,6 +305,7 @@ public function getModelName() const STATUS_CLOSED = 'closed'; const STATUS_CANCELLED = 'cancelled'; const TYPE_LIMIT = 'limit'; + const TYPE_MARKET = 'market'; const ACCOUNT_SPOT = 'spot'; const ACCOUNT_MARGIN = 'margin'; const ACCOUNT_CROSS_MARGIN = 'cross_margin'; @@ -298,6 +314,7 @@ public function getModelName() const TIME_IN_FORCE_GTC = 'gtc'; const TIME_IN_FORCE_IOC = 'ioc'; const TIME_IN_FORCE_POC = 'poc'; + const TIME_IN_FORCE_FOK = 'fok'; @@ -324,6 +341,7 @@ public function getTypeAllowableValues() { return [ self::TYPE_LIMIT, + self::TYPE_MARKET, ]; } @@ -365,6 +383,7 @@ public function getTimeInForceAllowableValues() self::TIME_IN_FORCE_GTC, self::TIME_IN_FORCE_IOC, self::TIME_IN_FORCE_POC, + self::TIME_IN_FORCE_FOK, ]; } @@ -404,10 +423,13 @@ public function __construct(array $data = null) $this->container['left'] = isset($data['left']) ? $data['left'] : null; $this->container['fill_price'] = isset($data['fill_price']) ? $data['fill_price'] : null; $this->container['filled_total'] = isset($data['filled_total']) ? $data['filled_total'] : null; + $this->container['avg_deal_price'] = isset($data['avg_deal_price']) ? $data['avg_deal_price'] : null; $this->container['fee'] = isset($data['fee']) ? $data['fee'] : null; $this->container['fee_currency'] = isset($data['fee_currency']) ? $data['fee_currency'] : null; $this->container['point_fee'] = isset($data['point_fee']) ? $data['point_fee'] : null; $this->container['gt_fee'] = isset($data['gt_fee']) ? $data['gt_fee'] : null; + $this->container['gt_maker_fee'] = isset($data['gt_maker_fee']) ? $data['gt_maker_fee'] : null; + $this->container['gt_taker_fee'] = isset($data['gt_taker_fee']) ? $data['gt_taker_fee'] : null; $this->container['gt_discount'] = isset($data['gt_discount']) ? $data['gt_discount'] : null; $this->container['rebated_fee'] = isset($data['rebated_fee']) ? $data['rebated_fee'] : null; $this->container['rebated_fee_currency'] = isset($data['rebated_fee_currency']) ? $data['rebated_fee_currency'] : null; @@ -463,9 +485,6 @@ public function listInvalidProperties() if ($this->container['amount'] === null) { $invalidProperties[] = "'amount' can't be null"; } - if ($this->container['price'] === null) { - $invalidProperties[] = "'price' can't be null"; - } $allowedValues = $this->getTimeInForceAllowableValues(); if (!is_null($this->container['time_in_force']) && !in_array($this->container['time_in_force'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -526,7 +545,7 @@ public function getText() /** * Sets text * - * @param string|null $text User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) + * @param string|null $text User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - 101: from android - 102: from IOS - 103: from IPAD - 104: from webapp - 3: from web - 2: from apiv2 - apiv4: from apiv4 * * @return $this */ @@ -550,7 +569,7 @@ public function getCreateTime() /** * Sets create_time * - * @param string|null $create_time Order creation time + * @param string|null $create_time Creation time of order * * @return $this */ @@ -574,7 +593,7 @@ public function getUpdateTime() /** * Sets update_time * - * @param string|null $update_time Order last modification time + * @param string|null $update_time Last modification time of order * * @return $this */ @@ -598,7 +617,7 @@ public function getCreateTimeMs() /** * Sets create_time_ms * - * @param int|null $create_time_ms Order creation time in milliseconds + * @param int|null $create_time_ms Creation time of order (in milliseconds) * * @return $this */ @@ -622,7 +641,7 @@ public function getUpdateTimeMs() /** * Sets update_time_ms * - * @param int|null $update_time_ms Order last modification time in milliseconds + * @param int|null $update_time_ms Last modification time of order (in milliseconds) * * @return $this */ @@ -703,7 +722,7 @@ public function getType() /** * Sets type * - * @param string|null $type Order type. limit - limit order + * @param string|null $type Order Type - limit : Limit Order - market : Market Order * * @return $this */ @@ -736,7 +755,7 @@ public function getAccount() /** * Sets account * - * @param string|null $account Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account + * @param string|null $account Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account. Portfolio margin account must set to `cross-margin` * * @return $this */ @@ -802,7 +821,7 @@ public function getAmount() /** * Sets amount * - * @param string $amount Trade amount + * @param string $amount When `type` is limit, it refers to base currency. For instance, `BTC_USDT` means `BTC` When `type` is `market`, it refers to different currency according to `side` - `side` : `buy` means quote currency, `BTC_USDT` means `USDT` - `side` : `sell` means base currency,`BTC_USDT` means `BTC` * * @return $this */ @@ -816,7 +835,7 @@ public function setAmount($amount) /** * Gets price * - * @return string + * @return string|null */ public function getPrice() { @@ -826,7 +845,7 @@ public function getPrice() /** * Sets price * - * @param string $price Order price + * @param string|null $price Price can't be empty when `type`= `limit` * * @return $this */ @@ -850,7 +869,7 @@ public function getTimeInForce() /** * Sets time_in_force * - * @param string|null $time_in_force Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee + * @param string|null $time_in_force Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee - fok: FillOrKill, fill either completely or none Only `ioc` and `fok` are supported when `type`=`market` * * @return $this */ @@ -883,7 +902,7 @@ public function getIceberg() /** * Sets iceberg * - * @param string|null $iceberg Amount to display for the iceberg order. Null or 0 for normal orders. Set to -1 to hide the amount totally + * @param string|null $iceberg Amount to display for the iceberg order. Null or 0 for normal orders. Hiding all amount is not supported. * * @return $this */ @@ -1014,6 +1033,30 @@ public function setFilledTotal($filled_total) return $this; } + /** + * Gets avg_deal_price + * + * @return string|null + */ + public function getAvgDealPrice() + { + return $this->container['avg_deal_price']; + } + + /** + * Sets avg_deal_price + * + * @param string|null $avg_deal_price Average fill price + * + * @return $this + */ + public function setAvgDealPrice($avg_deal_price) + { + $this->container['avg_deal_price'] = $avg_deal_price; + + return $this; + } + /** * Gets fee * @@ -1075,7 +1118,7 @@ public function getPointFee() /** * Sets point_fee * - * @param string|null $point_fee Point used to deduct fee + * @param string|null $point_fee Points used to deduct fee * * @return $this */ @@ -1110,6 +1153,54 @@ public function setGtFee($gt_fee) return $this; } + /** + * Gets gt_maker_fee + * + * @return string|null + */ + public function getGtMakerFee() + { + return $this->container['gt_maker_fee']; + } + + /** + * Sets gt_maker_fee + * + * @param string|null $gt_maker_fee GT used to deduct maker fee + * + * @return $this + */ + public function setGtMakerFee($gt_maker_fee) + { + $this->container['gt_maker_fee'] = $gt_maker_fee; + + return $this; + } + + /** + * Gets gt_taker_fee + * + * @return string|null + */ + public function getGtTakerFee() + { + return $this->container['gt_taker_fee']; + } + + /** + * Sets gt_taker_fee + * + * @param string|null $gt_taker_fee GT used to deduct taker fee + * + * @return $this + */ + public function setGtTakerFee($gt_taker_fee) + { + $this->container['gt_taker_fee'] = $gt_taker_fee; + + return $this; + } + /** * Gets gt_discount * @@ -1188,7 +1279,7 @@ public function setRebatedFeeCurrency($rebated_fee_currency) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1200,9 +1291,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -1213,7 +1305,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1229,7 +1321,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/OrderBook.php b/src/Model/OrderBook.php index 3215832..c0bf3f6 100644 --- a/src/Model/OrderBook.php +++ b/src/Model/OrderBook.php @@ -42,30 +42,34 @@ class OrderBook implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'OrderBook'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', + 'current' => 'int', + 'update' => 'int', 'asks' => 'string[][]', 'bids' => 'string[][]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64', + 'current' => 'int64', + 'update' => 'int64', 'asks' => null, 'bids' => null ]; @@ -98,6 +102,8 @@ public static function openAPIFormats() */ protected static $attributeMap = [ 'id' => 'id', + 'current' => 'current', + 'update' => 'update', 'asks' => 'asks', 'bids' => 'bids' ]; @@ -109,6 +115,8 @@ public static function openAPIFormats() */ protected static $setters = [ 'id' => 'setId', + 'current' => 'setCurrent', + 'update' => 'setUpdate', 'asks' => 'setAsks', 'bids' => 'setBids' ]; @@ -120,6 +128,8 @@ public static function openAPIFormats() */ protected static $getters = [ 'id' => 'getId', + 'current' => 'getCurrent', + 'update' => 'getUpdate', 'asks' => 'getAsks', 'bids' => 'getBids' ]; @@ -185,6 +195,8 @@ public function getModelName() public function __construct(array $data = null) { $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['current'] = isset($data['current']) ? $data['current'] : null; + $this->container['update'] = isset($data['update']) ? $data['update'] : null; $this->container['asks'] = isset($data['asks']) ? $data['asks'] : null; $this->container['bids'] = isset($data['bids']) ? $data['bids'] : null; } @@ -243,6 +255,54 @@ public function setId($id) return $this; } + /** + * Gets current + * + * @return int|null + */ + public function getCurrent() + { + return $this->container['current']; + } + + /** + * Sets current + * + * @param int|null $current The timestamp of the response data being generated (in milliseconds) + * + * @return $this + */ + public function setCurrent($current) + { + $this->container['current'] = $current; + + return $this; + } + + /** + * Gets update + * + * @return int|null + */ + public function getUpdate() + { + return $this->container['update']; + } + + /** + * Sets update + * + * @param int|null $update The timestamp of when the orderbook last changed (in milliseconds) + * + * @return $this + */ + public function setUpdate($update) + { + $this->container['update'] = $update; + + return $this; + } + /** * Gets asks * @@ -297,7 +357,7 @@ public function setBids($bids) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -309,9 +369,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -322,7 +383,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -338,7 +399,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/OrderPatch.php b/src/Model/OrderPatch.php new file mode 100644 index 0000000..43df2cf --- /dev/null +++ b/src/Model/OrderPatch.php @@ -0,0 +1,336 @@ + 'string', + 'price' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'price' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'amount' => 'amount', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'price' => 'getPrice' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount New order amount. `amount` and `price` must specify one of them + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price New order price. `amount` and `Price` must specify one of them\" + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Position.php b/src/Model/Position.php index 01dc2ef..d2c8bc7 100644 --- a/src/Model/Position.php +++ b/src/Model/Position.php @@ -43,17 +43,17 @@ class Position implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Position'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'user' => 'int', 'contract' => 'string', @@ -67,6 +67,8 @@ class Position implements ModelInterface, ArrayAccess 'entry_price' => 'string', 'liq_price' => 'string', 'mark_price' => 'string', + 'initial_margin' => 'string', + 'maintenance_margin' => 'string', 'unrealised_pnl' => 'string', 'realised_pnl' => 'string', 'history_pnl' => 'string', @@ -81,10 +83,10 @@ class Position implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'user' => 'int64', 'contract' => null, @@ -98,6 +100,8 @@ class Position implements ModelInterface, ArrayAccess 'entry_price' => null, 'liq_price' => null, 'mark_price' => null, + 'initial_margin' => null, + 'maintenance_margin' => null, 'unrealised_pnl' => null, 'realised_pnl' => null, 'history_pnl' => null, @@ -150,6 +154,8 @@ public static function openAPIFormats() 'entry_price' => 'entry_price', 'liq_price' => 'liq_price', 'mark_price' => 'mark_price', + 'initial_margin' => 'initial_margin', + 'maintenance_margin' => 'maintenance_margin', 'unrealised_pnl' => 'unrealised_pnl', 'realised_pnl' => 'realised_pnl', 'history_pnl' => 'history_pnl', @@ -181,6 +187,8 @@ public static function openAPIFormats() 'entry_price' => 'setEntryPrice', 'liq_price' => 'setLiqPrice', 'mark_price' => 'setMarkPrice', + 'initial_margin' => 'setInitialMargin', + 'maintenance_margin' => 'setMaintenanceMargin', 'unrealised_pnl' => 'setUnrealisedPnl', 'realised_pnl' => 'setRealisedPnl', 'history_pnl' => 'setHistoryPnl', @@ -212,6 +220,8 @@ public static function openAPIFormats() 'entry_price' => 'getEntryPrice', 'liq_price' => 'getLiqPrice', 'mark_price' => 'getMarkPrice', + 'initial_margin' => 'getInitialMargin', + 'maintenance_margin' => 'getMaintenanceMargin', 'unrealised_pnl' => 'getUnrealisedPnl', 'realised_pnl' => 'getRealisedPnl', 'history_pnl' => 'getHistoryPnl', @@ -314,6 +324,8 @@ public function __construct(array $data = null) $this->container['entry_price'] = isset($data['entry_price']) ? $data['entry_price'] : null; $this->container['liq_price'] = isset($data['liq_price']) ? $data['liq_price'] : null; $this->container['mark_price'] = isset($data['mark_price']) ? $data['mark_price'] : null; + $this->container['initial_margin'] = isset($data['initial_margin']) ? $data['initial_margin'] : null; + $this->container['maintenance_margin'] = isset($data['maintenance_margin']) ? $data['maintenance_margin'] : null; $this->container['unrealised_pnl'] = isset($data['unrealised_pnl']) ? $data['unrealised_pnl'] : null; $this->container['realised_pnl'] = isset($data['realised_pnl']) ? $data['realised_pnl'] : null; $this->container['history_pnl'] = isset($data['history_pnl']) ? $data['history_pnl'] : null; @@ -647,6 +659,54 @@ public function setMarkPrice($mark_price) return $this; } + /** + * Gets initial_margin + * + * @return string|null + */ + public function getInitialMargin() + { + return $this->container['initial_margin']; + } + + /** + * Sets initial_margin + * + * @param string|null $initial_margin The initial margin occupied by the position, applicable to the portfolio margin account + * + * @return $this + */ + public function setInitialMargin($initial_margin) + { + $this->container['initial_margin'] = $initial_margin; + + return $this; + } + + /** + * Gets maintenance_margin + * + * @return string|null + */ + public function getMaintenanceMargin() + { + return $this->container['maintenance_margin']; + } + + /** + * Sets maintenance_margin + * + * @param string|null $maintenance_margin Maintenance margin required for the position, applicable to portfolio margin account + * + * @return $this + */ + public function setMaintenanceMargin($maintenance_margin) + { + $this->container['maintenance_margin'] = $maintenance_margin; + + return $this; + } + /** * Gets unrealised_pnl * @@ -804,7 +864,7 @@ public function getAdlRanking() /** * Sets adl_ranking * - * @param int|null $adl_ranking ADL ranking, range from 1 to 5 + * @param int|null $adl_ranking ADL ranking, ranging from 1 to 5 * * @return $this */ @@ -926,7 +986,7 @@ public function setCrossLeverageLimit($cross_leverage_limit) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -938,9 +998,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -951,7 +1012,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -967,7 +1028,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/PositionClose.php b/src/Model/PositionClose.php index 02f2024..313cee2 100644 --- a/src/Model/PositionClose.php +++ b/src/Model/PositionClose.php @@ -42,17 +42,17 @@ class PositionClose implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'PositionClose'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'time' => 'double', 'contract' => 'string', @@ -62,10 +62,10 @@ class PositionClose implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'time' => 'double', 'contract' => null, @@ -383,7 +383,7 @@ public function setText($text) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -395,9 +395,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -408,7 +409,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -424,7 +425,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/PositionCloseOrder.php b/src/Model/PositionCloseOrder.php index 861368c..833bb0b 100644 --- a/src/Model/PositionCloseOrder.php +++ b/src/Model/PositionCloseOrder.php @@ -43,17 +43,17 @@ class PositionCloseOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Position_close_order'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'price' => 'string', @@ -61,10 +61,10 @@ class PositionCloseOrder implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64', 'price' => null, @@ -292,7 +292,7 @@ public function setIsLiq($is_liq) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -304,9 +304,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -317,7 +318,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -333,7 +334,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/RepayRequest.php b/src/Model/RepayRequest.php index 576a6c6..a76018f 100644 --- a/src/Model/RepayRequest.php +++ b/src/Model/RepayRequest.php @@ -42,17 +42,17 @@ class RepayRequest implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'RepayRequest'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency_pair' => 'string', 'currency' => 'string', @@ -61,10 +61,10 @@ class RepayRequest implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency_pair' => null, 'currency' => null, @@ -362,7 +362,7 @@ public function setAmount($amount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -374,9 +374,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -387,7 +388,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -403,7 +404,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/Repayment.php b/src/Model/Repayment.php index cd2f12a..55f3eb9 100644 --- a/src/Model/Repayment.php +++ b/src/Model/Repayment.php @@ -42,17 +42,17 @@ class Repayment implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Repayment'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'create_time' => 'string', @@ -61,10 +61,10 @@ class Repayment implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'create_time' => null, @@ -321,7 +321,7 @@ public function setInterest($interest) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -333,9 +333,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -346,7 +347,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -362,7 +363,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SavedAddress.php b/src/Model/SavedAddress.php new file mode 100644 index 0000000..0234ca6 --- /dev/null +++ b/src/Model/SavedAddress.php @@ -0,0 +1,455 @@ + 'string', + 'chain' => 'string', + 'address' => 'string', + 'name' => 'string', + 'tag' => 'string', + 'verified' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'chain' => null, + 'address' => null, + 'name' => null, + 'tag' => null, + 'verified' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'chain' => 'chain', + 'address' => 'address', + 'name' => 'name', + 'tag' => 'tag', + 'verified' => 'verified' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'chain' => 'setChain', + 'address' => 'setAddress', + 'name' => 'setName', + 'tag' => 'setTag', + 'verified' => 'setVerified' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'chain' => 'getChain', + 'address' => 'getAddress', + 'name' => 'getName', + 'tag' => 'getTag', + 'verified' => 'getVerified' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['chain'] = isset($data['chain']) ? $data['chain'] : null; + $this->container['address'] = isset($data['address']) ? $data['address'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null; + $this->container['verified'] = isset($data['verified']) ? $data['verified'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets chain + * + * @return string|null + */ + public function getChain() + { + return $this->container['chain']; + } + + /** + * Sets chain + * + * @param string|null $chain Chain name + * + * @return $this + */ + public function setChain($chain) + { + $this->container['chain'] = $chain; + + return $this; + } + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address Address + * + * @return $this + */ + public function setAddress($address) + { + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag() + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag Tag + * + * @return $this + */ + public function setTag($tag) + { + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets verified + * + * @return string|null + */ + public function getVerified() + { + return $this->container['verified']; + } + + /** + * Sets verified + * + * @param string|null $verified Whether to pass the verification 0-unverified, 1-verified + * + * @return $this + */ + public function setVerified($verified) + { + $this->container['verified'] = $verified; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SpotAccount.php b/src/Model/SpotAccount.php index 630f206..c7d0970 100644 --- a/src/Model/SpotAccount.php +++ b/src/Model/SpotAccount.php @@ -42,17 +42,17 @@ class SpotAccount implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'SpotAccount'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'available' => 'string', @@ -60,10 +60,10 @@ class SpotAccount implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'available' => null, @@ -291,7 +291,7 @@ public function setLocked($locked) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -303,9 +303,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -316,7 +317,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -332,7 +333,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SpotFee.php b/src/Model/SpotFee.php new file mode 100644 index 0000000..94262b8 --- /dev/null +++ b/src/Model/SpotFee.php @@ -0,0 +1,545 @@ + 'int', + 'taker_fee' => 'string', + 'maker_fee' => 'string', + 'gt_discount' => 'bool', + 'gt_taker_fee' => 'string', + 'gt_maker_fee' => 'string', + 'loan_fee' => 'string', + 'point_type' => 'string', + 'currency_pair' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'user_id' => 'int64', + 'taker_fee' => null, + 'maker_fee' => null, + 'gt_discount' => null, + 'gt_taker_fee' => null, + 'gt_maker_fee' => null, + 'loan_fee' => null, + 'point_type' => null, + 'currency_pair' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user_id' => 'user_id', + 'taker_fee' => 'taker_fee', + 'maker_fee' => 'maker_fee', + 'gt_discount' => 'gt_discount', + 'gt_taker_fee' => 'gt_taker_fee', + 'gt_maker_fee' => 'gt_maker_fee', + 'loan_fee' => 'loan_fee', + 'point_type' => 'point_type', + 'currency_pair' => 'currency_pair' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user_id' => 'setUserId', + 'taker_fee' => 'setTakerFee', + 'maker_fee' => 'setMakerFee', + 'gt_discount' => 'setGtDiscount', + 'gt_taker_fee' => 'setGtTakerFee', + 'gt_maker_fee' => 'setGtMakerFee', + 'loan_fee' => 'setLoanFee', + 'point_type' => 'setPointType', + 'currency_pair' => 'setCurrencyPair' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user_id' => 'getUserId', + 'taker_fee' => 'getTakerFee', + 'maker_fee' => 'getMakerFee', + 'gt_discount' => 'getGtDiscount', + 'gt_taker_fee' => 'getGtTakerFee', + 'gt_maker_fee' => 'getGtMakerFee', + 'loan_fee' => 'getLoanFee', + 'point_type' => 'getPointType', + 'currency_pair' => 'getCurrencyPair' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['taker_fee'] = isset($data['taker_fee']) ? $data['taker_fee'] : null; + $this->container['maker_fee'] = isset($data['maker_fee']) ? $data['maker_fee'] : null; + $this->container['gt_discount'] = isset($data['gt_discount']) ? $data['gt_discount'] : null; + $this->container['gt_taker_fee'] = isset($data['gt_taker_fee']) ? $data['gt_taker_fee'] : null; + $this->container['gt_maker_fee'] = isset($data['gt_maker_fee']) ? $data['gt_maker_fee'] : null; + $this->container['loan_fee'] = isset($data['loan_fee']) ? $data['loan_fee'] : null; + $this->container['point_type'] = isset($data['point_type']) ? $data['point_type'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 user_id + * + * @return int|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param int|null $user_id User ID + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets taker_fee + * + * @return string|null + */ + public function getTakerFee() + { + return $this->container['taker_fee']; + } + + /** + * Sets taker_fee + * + * @param string|null $taker_fee taker fee rate + * + * @return $this + */ + public function setTakerFee($taker_fee) + { + $this->container['taker_fee'] = $taker_fee; + + return $this; + } + + /** + * Gets maker_fee + * + * @return string|null + */ + public function getMakerFee() + { + return $this->container['maker_fee']; + } + + /** + * Sets maker_fee + * + * @param string|null $maker_fee maker fee rate + * + * @return $this + */ + public function setMakerFee($maker_fee) + { + $this->container['maker_fee'] = $maker_fee; + + return $this; + } + + /** + * Gets gt_discount + * + * @return bool|null + */ + public function getGtDiscount() + { + return $this->container['gt_discount']; + } + + /** + * Sets gt_discount + * + * @param bool|null $gt_discount If GT deduction is enabled + * + * @return $this + */ + public function setGtDiscount($gt_discount) + { + $this->container['gt_discount'] = $gt_discount; + + return $this; + } + + /** + * Gets gt_taker_fee + * + * @return string|null + */ + public function getGtTakerFee() + { + return $this->container['gt_taker_fee']; + } + + /** + * Sets gt_taker_fee + * + * @param string|null $gt_taker_fee Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled + * + * @return $this + */ + public function setGtTakerFee($gt_taker_fee) + { + $this->container['gt_taker_fee'] = $gt_taker_fee; + + return $this; + } + + /** + * Gets gt_maker_fee + * + * @return string|null + */ + public function getGtMakerFee() + { + return $this->container['gt_maker_fee']; + } + + /** + * Sets gt_maker_fee + * + * @param string|null $gt_maker_fee Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled + * + * @return $this + */ + public function setGtMakerFee($gt_maker_fee) + { + $this->container['gt_maker_fee'] = $gt_maker_fee; + + return $this; + } + + /** + * Gets loan_fee + * + * @return string|null + */ + public function getLoanFee() + { + return $this->container['loan_fee']; + } + + /** + * Sets loan_fee + * + * @param string|null $loan_fee Loan fee rate of margin lending + * + * @return $this + */ + public function setLoanFee($loan_fee) + { + $this->container['loan_fee'] = $loan_fee; + + return $this; + } + + /** + * Gets point_type + * + * @return string|null + */ + public function getPointType() + { + return $this->container['point_type']; + } + + /** + * Sets point_type + * + * @param string|null $point_type Point type. 0 - Initial version. 1 - new version since 202009 + * + * @return $this + */ + public function setPointType($point_type) + { + $this->container['point_type'] = $point_type; + + return $this; + } + + /** + * Gets currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SpotPricePutOrder.php b/src/Model/SpotPricePutOrder.php index 7b30c26..9bdd40f 100644 --- a/src/Model/SpotPricePutOrder.php +++ b/src/Model/SpotPricePutOrder.php @@ -42,17 +42,17 @@ class SpotPricePutOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'SpotPricePutOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'side' => 'string', @@ -63,10 +63,10 @@ class SpotPricePutOrder implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'type' => null, 'side' => null, @@ -184,6 +184,7 @@ public function getModelName() const SIDE_SELL = 'sell'; const ACCOUNT_NORMAL = 'normal'; const ACCOUNT_MARGIN = 'margin'; + const ACCOUNT_CROSS_MARGIN = 'cross_margin'; const TIME_IN_FORCE_GTC = 'gtc'; const TIME_IN_FORCE_IOC = 'ioc'; @@ -212,6 +213,7 @@ public function getAccountAllowableValues() return [ self::ACCOUNT_NORMAL, self::ACCOUNT_MARGIN, + self::ACCOUNT_CROSS_MARGIN, ]; } @@ -248,8 +250,8 @@ public function __construct(array $data = null) $this->container['side'] = isset($data['side']) ? $data['side'] : null; $this->container['price'] = isset($data['price']) ? $data['price'] : null; $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; - $this->container['account'] = isset($data['account']) ? $data['account'] : null; - $this->container['time_in_force'] = isset($data['time_in_force']) ? $data['time_in_force'] : null; + $this->container['account'] = isset($data['account']) ? $data['account'] : 'normal'; + $this->container['time_in_force'] = isset($data['time_in_force']) ? $data['time_in_force'] : 'gtc'; } /** @@ -430,7 +432,7 @@ public function getAccount() /** * Sets account * - * @param string $account Trading type - normal: spot trading - margin: margin trading + * @param string $account Trading account type. Portfolio margin account must set to `cross_margin` - normal: spot trading - margin: margin trading - cross_margin: cross_margin trading * * @return $this */ @@ -489,7 +491,7 @@ public function setTimeInForce($time_in_force) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -501,9 +503,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -514,7 +517,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -530,7 +533,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SpotPriceTrigger.php b/src/Model/SpotPriceTrigger.php index 0682b07..dec17a9 100644 --- a/src/Model/SpotPriceTrigger.php +++ b/src/Model/SpotPriceTrigger.php @@ -42,17 +42,17 @@ class SpotPriceTrigger implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'SpotPriceTrigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'price' => 'string', 'rule' => 'string', @@ -60,10 +60,10 @@ class SpotPriceTrigger implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'price' => null, 'rule' => null, @@ -315,7 +315,7 @@ public function getExpiration() /** * Sets expiration * - * @param int $expiration How many seconds will the order wait for the condition being triggered. Order will be cancelled on timed out + * @param int $expiration How long (in seconds) to wait for the condition to be triggered before cancelling the order. * * @return $this */ @@ -332,7 +332,7 @@ public function setExpiration($expiration) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -344,9 +344,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -357,7 +358,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -373,7 +374,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SpotPriceTriggeredOrder.php b/src/Model/SpotPriceTriggeredOrder.php index 8a88c11..8642694 100644 --- a/src/Model/SpotPriceTriggeredOrder.php +++ b/src/Model/SpotPriceTriggeredOrder.php @@ -43,43 +43,43 @@ class SpotPriceTriggeredOrder implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'SpotPriceTriggeredOrder'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'trigger' => '\GateApi\Model\SpotPriceTrigger', 'put' => '\GateApi\Model\SpotPricePutOrder', 'id' => 'int', 'user' => 'int', 'market' => 'string', - 'ctime' => 'double', - 'ftime' => 'double', + 'ctime' => 'int', + 'ftime' => 'int', 'fired_order_id' => 'int', 'status' => 'string', 'reason' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'trigger' => null, 'put' => null, 'id' => 'int64', 'user' => null, 'market' => null, - 'ctime' => 'double', - 'ftime' => 'double', + 'ctime' => 'int64', + 'ftime' => 'int64', 'fired_order_id' => 'int64', 'status' => null, 'reason' => null @@ -388,7 +388,7 @@ public function setMarket($market) /** * Gets ctime * - * @return double|null + * @return int|null */ public function getCtime() { @@ -398,7 +398,7 @@ public function getCtime() /** * Sets ctime * - * @param double|null $ctime Creation time + * @param int|null $ctime Creation time * * @return $this */ @@ -412,7 +412,7 @@ public function setCtime($ctime) /** * Gets ftime * - * @return double|null + * @return int|null */ public function getFtime() { @@ -422,7 +422,7 @@ public function getFtime() /** * Sets ftime * - * @param double|null $ftime Finished time + * @param int|null $ftime Finished time * * @return $this */ @@ -494,7 +494,7 @@ public function getReason() /** * Sets reason * - * @param string|null $reason Extra messages of how order is finished + * @param string|null $reason Additional remarks on how the order was finished * * @return $this */ @@ -511,7 +511,7 @@ public function setReason($reason) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -523,9 +523,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -536,7 +537,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -552,7 +553,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SubAccount.php b/src/Model/SubAccount.php new file mode 100644 index 0000000..b22cd66 --- /dev/null +++ b/src/Model/SubAccount.php @@ -0,0 +1,518 @@ + 'string', + 'login_name' => 'string', + 'password' => 'string', + 'email' => 'string', + 'state' => 'int', + 'type' => 'int', + 'user_id' => 'int', + 'create_time' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'remark' => null, + 'login_name' => null, + 'password' => null, + 'email' => null, + 'state' => 'int32', + 'type' => 'int32', + 'user_id' => 'int64', + 'create_time' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'remark' => 'remark', + 'login_name' => 'login_name', + 'password' => 'password', + 'email' => 'email', + 'state' => 'state', + 'type' => 'type', + 'user_id' => 'user_id', + 'create_time' => 'create_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'remark' => 'setRemark', + 'login_name' => 'setLoginName', + 'password' => 'setPassword', + 'email' => 'setEmail', + 'state' => 'setState', + 'type' => 'setType', + 'user_id' => 'setUserId', + 'create_time' => 'setCreateTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'remark' => 'getRemark', + 'login_name' => 'getLoginName', + 'password' => 'getPassword', + 'email' => 'getEmail', + 'state' => 'getState', + 'type' => 'getType', + 'user_id' => 'getUserId', + 'create_time' => 'getCreateTime' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['remark'] = isset($data['remark']) ? $data['remark'] : null; + $this->container['login_name'] = isset($data['login_name']) ? $data['login_name'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['login_name'] === null) { + $invalidProperties[] = "'login_name' 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 remark + * + * @return string|null + */ + public function getRemark() + { + return $this->container['remark']; + } + + /** + * Sets remark + * + * @param string|null $remark custom text + * + * @return $this + */ + public function setRemark($remark) + { + $this->container['remark'] = $remark; + + return $this; + } + + /** + * Gets login_name + * + * @return string + */ + public function getLoginName() + { + return $this->container['login_name']; + } + + /** + * Sets login_name + * + * @param string $login_name Sub-account login name: Only letters, numbers and underscores are supported, and cannot contain other illegal characters + * + * @return $this + */ + public function setLoginName($login_name) + { + $this->container['login_name'] = $login_name; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password The sub-account's password. (Default: the same as main account's password) + * + * @return $this + */ + public function setPassword($password) + { + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The sub-account's email address. (Default: the same as main account's email address) + * + * @return $this + */ + public function setEmail($email) + { + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets state + * + * @return int|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param int|null $state State: 1-normal, 2-locked\" + * + * @return $this + */ + public function setState($state) + { + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets type + * + * @return int|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param int|null $type Type: 1-Sub-account + * + * @return $this + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets user_id + * + * @return int|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param int|null $user_id The user id of the sub-account + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets create_time + * + * @return int|null + */ + public function getCreateTime() + { + return $this->container['create_time']; + } + + /** + * Sets create_time + * + * @param int|null $create_time Created time + * + * @return $this + */ + public function setCreateTime($create_time) + { + $this->container['create_time'] = $create_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SubAccountBalance.php b/src/Model/SubAccountBalance.php index e955bdb..3c57757 100644 --- a/src/Model/SubAccountBalance.php +++ b/src/Model/SubAccountBalance.php @@ -42,27 +42,27 @@ class SubAccountBalance implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'SubAccountBalance'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'uid' => 'string', 'available' => 'map[string,string]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'uid' => null, 'available' => null @@ -261,7 +261,7 @@ public function setAvailable($available) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -273,9 +273,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -286,7 +287,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -302,7 +303,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SubAccountCrossMarginBalance.php b/src/Model/SubAccountCrossMarginBalance.php new file mode 100644 index 0000000..c4ca7ba --- /dev/null +++ b/src/Model/SubAccountCrossMarginBalance.php @@ -0,0 +1,335 @@ + 'string', + 'available' => '\GateApi\Model\SubCrossMarginAccount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'uid' => null, + 'available' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'uid' => 'uid', + 'available' => 'available' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'uid' => 'setUid', + 'available' => 'setAvailable' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'uid' => 'getUid', + 'available' => 'getAvailable' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['uid'] = isset($data['uid']) ? $data['uid'] : null; + $this->container['available'] = isset($data['available']) ? $data['available'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid User ID + * + * @return $this + */ + public function setUid($uid) + { + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets available + * + * @return \GateApi\Model\SubCrossMarginAccount|null + */ + public function getAvailable() + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param \GateApi\Model\SubCrossMarginAccount|null $available 账户余额信息 + * + * @return $this + */ + public function setAvailable($available) + { + $this->container['available'] = $available; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SubAccountFuturesBalance.php b/src/Model/SubAccountFuturesBalance.php new file mode 100644 index 0000000..a5caabd --- /dev/null +++ b/src/Model/SubAccountFuturesBalance.php @@ -0,0 +1,335 @@ + 'string', + 'available' => 'map[string,\GateApi\Model\FuturesAccount]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'uid' => null, + 'available' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'uid' => 'uid', + 'available' => 'available' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'uid' => 'setUid', + 'available' => 'setAvailable' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'uid' => 'getUid', + 'available' => 'getAvailable' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['uid'] = isset($data['uid']) ? $data['uid'] : null; + $this->container['available'] = isset($data['available']) ? $data['available'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid User ID + * + * @return $this + */ + public function setUid($uid) + { + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets available + * + * @return map[string,\GateApi\Model\FuturesAccount]|null + */ + public function getAvailable() + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param map[string,\GateApi\Model\FuturesAccount]|null $available Futures account balances + * + * @return $this + */ + public function setAvailable($available) + { + $this->container['available'] = $available; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SubAccountKey.php b/src/Model/SubAccountKey.php new file mode 100644 index 0000000..5bbc16d --- /dev/null +++ b/src/Model/SubAccountKey.php @@ -0,0 +1,515 @@ + 'string', + 'name' => 'string', + 'perms' => '\GateApi\Model\ApiV4KeyPerm[]', + 'ip_whitelist' => 'string[]', + 'key' => 'string', + 'state' => 'int', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'user_id' => null, + 'name' => null, + 'perms' => null, + 'ip_whitelist' => null, + 'key' => null, + 'state' => 'int32', + 'created_at' => null, + 'updated_at' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user_id' => 'user_id', + 'name' => 'name', + 'perms' => 'perms', + 'ip_whitelist' => 'ip_whitelist', + 'key' => 'key', + 'state' => 'state', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user_id' => 'setUserId', + 'name' => 'setName', + 'perms' => 'setPerms', + 'ip_whitelist' => 'setIpWhitelist', + 'key' => 'setKey', + 'state' => 'setState', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user_id' => 'getUserId', + 'name' => 'getName', + 'perms' => 'getPerms', + 'ip_whitelist' => 'getIpWhitelist', + 'key' => 'getKey', + 'state' => 'getState', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['perms'] = isset($data['perms']) ? $data['perms'] : null; + $this->container['ip_whitelist'] = isset($data['ip_whitelist']) ? $data['ip_whitelist'] : null; + $this->container['key'] = isset($data['key']) ? $data['key'] : null; + $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->container['created_at'] = isset($data['created_at']) ? $data['created_at'] : null; + $this->container['updated_at'] = isset($data['updated_at']) ? $data['updated_at'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 user_id + * + * @return string|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param string|null $user_id User ID + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name API key name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets perms + * + * @return \GateApi\Model\ApiV4KeyPerm[]|null + */ + public function getPerms() + { + return $this->container['perms']; + } + + /** + * Sets perms + * + * @param \GateApi\Model\ApiV4KeyPerm[]|null $perms perms + * + * @return $this + */ + public function setPerms($perms) + { + $this->container['perms'] = $perms; + + return $this; + } + + /** + * Gets ip_whitelist + * + * @return string[]|null + */ + public function getIpWhitelist() + { + return $this->container['ip_whitelist']; + } + + /** + * Sets ip_whitelist + * + * @param string[]|null $ip_whitelist ip white list (list will be removed if no value is passed) + * + * @return $this + */ + public function setIpWhitelist($ip_whitelist) + { + $this->container['ip_whitelist'] = $ip_whitelist; + + return $this; + } + + /** + * Gets key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key API Key + * + * @return $this + */ + public function setKey($key) + { + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets state + * + * @return int|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param int|null $state State 1 - normal 2 - locked 3 - frozen + * + * @return $this + */ + public function setState($state) + { + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at Creation time + * + * @return $this + */ + public function setCreatedAt($created_at) + { + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at Last update time + * + * @return $this + */ + public function setUpdatedAt($updated_at) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SubAccountMarginBalance.php b/src/Model/SubAccountMarginBalance.php new file mode 100644 index 0000000..fda523d --- /dev/null +++ b/src/Model/SubAccountMarginBalance.php @@ -0,0 +1,335 @@ + 'string', + 'available' => '\GateApi\Model\MarginAccount[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'uid' => null, + 'available' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'uid' => 'uid', + 'available' => 'available' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'uid' => 'setUid', + 'available' => 'setAvailable' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'uid' => 'getUid', + 'available' => 'getAvailable' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['uid'] = isset($data['uid']) ? $data['uid'] : null; + $this->container['available'] = isset($data['available']) ? $data['available'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 uid + * + * @return string|null + */ + public function getUid() + { + return $this->container['uid']; + } + + /** + * Sets uid + * + * @param string|null $uid User ID + * + * @return $this + */ + public function setUid($uid) + { + $this->container['uid'] = $uid; + + return $this; + } + + /** + * Gets available + * + * @return \GateApi\Model\MarginAccount[]|null + */ + public function getAvailable() + { + return $this->container['available']; + } + + /** + * Sets available + * + * @param \GateApi\Model\MarginAccount[]|null $available Margin account balances + * + * @return $this + */ + public function setAvailable($available) + { + $this->container['available'] = $available; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SubAccountToSubAccount.php b/src/Model/SubAccountToSubAccount.php new file mode 100644 index 0000000..bb8191c --- /dev/null +++ b/src/Model/SubAccountToSubAccount.php @@ -0,0 +1,571 @@ + 'string', + 'sub_account_type' => 'string', + 'sub_account_from' => 'string', + 'sub_account_from_type' => 'string', + 'sub_account_to' => 'string', + 'sub_account_to_type' => 'string', + 'amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'sub_account_type' => null, + 'sub_account_from' => null, + 'sub_account_from_type' => null, + 'sub_account_to' => null, + 'sub_account_to_type' => null, + 'amount' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'currency' => 'currency', + 'sub_account_type' => 'sub_account_type', + 'sub_account_from' => 'sub_account_from', + 'sub_account_from_type' => 'sub_account_from_type', + 'sub_account_to' => 'sub_account_to', + 'sub_account_to_type' => 'sub_account_to_type', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'sub_account_type' => 'setSubAccountType', + 'sub_account_from' => 'setSubAccountFrom', + 'sub_account_from_type' => 'setSubAccountFromType', + 'sub_account_to' => 'setSubAccountTo', + 'sub_account_to_type' => 'setSubAccountToType', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'sub_account_type' => 'getSubAccountType', + 'sub_account_from' => 'getSubAccountFrom', + 'sub_account_from_type' => 'getSubAccountFromType', + 'sub_account_to' => 'getSubAccountTo', + 'sub_account_to_type' => 'getSubAccountToType', + 'amount' => 'getAmount' + ]; + + /** + * 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::$openAPIModelName; + } + + const SUB_ACCOUNT_FROM_TYPE_SPOT = 'spot'; + const SUB_ACCOUNT_FROM_TYPE_FUTURES = 'futures'; + const SUB_ACCOUNT_FROM_TYPE_CROSS_MARGIN = 'cross_margin'; + const SUB_ACCOUNT_TO_TYPE_SPOT = 'spot'; + const SUB_ACCOUNT_TO_TYPE_FUTURES = 'futures'; + const SUB_ACCOUNT_TO_TYPE_CROSS_MARGIN = 'cross_margin'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSubAccountFromTypeAllowableValues() + { + return [ + self::SUB_ACCOUNT_FROM_TYPE_SPOT, + self::SUB_ACCOUNT_FROM_TYPE_FUTURES, + self::SUB_ACCOUNT_FROM_TYPE_CROSS_MARGIN, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSubAccountToTypeAllowableValues() + { + return [ + self::SUB_ACCOUNT_TO_TYPE_SPOT, + self::SUB_ACCOUNT_TO_TYPE_FUTURES, + self::SUB_ACCOUNT_TO_TYPE_CROSS_MARGIN, + ]; + } + + + /** + * 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['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['sub_account_type'] = isset($data['sub_account_type']) ? $data['sub_account_type'] : null; + $this->container['sub_account_from'] = isset($data['sub_account_from']) ? $data['sub_account_from'] : null; + $this->container['sub_account_from_type'] = isset($data['sub_account_from_type']) ? $data['sub_account_from_type'] : null; + $this->container['sub_account_to'] = isset($data['sub_account_to']) ? $data['sub_account_to'] : null; + $this->container['sub_account_to_type'] = isset($data['sub_account_to_type']) ? $data['sub_account_to_type'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['sub_account_from'] === null) { + $invalidProperties[] = "'sub_account_from' can't be null"; + } + if ($this->container['sub_account_from_type'] === null) { + $invalidProperties[] = "'sub_account_from_type' can't be null"; + } + $allowedValues = $this->getSubAccountFromTypeAllowableValues(); + if (!is_null($this->container['sub_account_from_type']) && !in_array($this->container['sub_account_from_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'sub_account_from_type', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + if ($this->container['sub_account_to'] === null) { + $invalidProperties[] = "'sub_account_to' can't be null"; + } + if ($this->container['sub_account_to_type'] === null) { + $invalidProperties[] = "'sub_account_to_type' can't be null"; + } + $allowedValues = $this->getSubAccountToTypeAllowableValues(); + if (!is_null($this->container['sub_account_to_type']) && !in_array($this->container['sub_account_to_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'sub_account_to_type', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' 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 currency + * + * @return string + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string $currency Transfer currency name + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets sub_account_type + * + * @return string|null + */ + public function getSubAccountType() + { + return $this->container['sub_account_type']; + } + + /** + * Sets sub_account_type + * + * @param string|null $sub_account_type Transfer from the account. (deprecate, use `sub_account_from_type` and `sub_account_to_type` instead) + * + * @return $this + */ + public function setSubAccountType($sub_account_type) + { + $this->container['sub_account_type'] = $sub_account_type; + + return $this; + } + + /** + * Gets sub_account_from + * + * @return string + */ + public function getSubAccountFrom() + { + return $this->container['sub_account_from']; + } + + /** + * Sets sub_account_from + * + * @param string $sub_account_from Transfer from the user id of the sub-account + * + * @return $this + */ + public function setSubAccountFrom($sub_account_from) + { + $this->container['sub_account_from'] = $sub_account_from; + + return $this; + } + + /** + * Gets sub_account_from_type + * + * @return string + */ + public function getSubAccountFromType() + { + return $this->container['sub_account_from_type']; + } + + /** + * Sets sub_account_from_type + * + * @param string $sub_account_from_type Transfer from the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account + * + * @return $this + */ + public function setSubAccountFromType($sub_account_from_type) + { + $allowedValues = $this->getSubAccountFromTypeAllowableValues(); + if (!in_array($sub_account_from_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'sub_account_from_type', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['sub_account_from_type'] = $sub_account_from_type; + + return $this; + } + + /** + * Gets sub_account_to + * + * @return string + */ + public function getSubAccountTo() + { + return $this->container['sub_account_to']; + } + + /** + * Sets sub_account_to + * + * @param string $sub_account_to Transfer to the user id of the sub-account + * + * @return $this + */ + public function setSubAccountTo($sub_account_to) + { + $this->container['sub_account_to'] = $sub_account_to; + + return $this; + } + + /** + * Gets sub_account_to_type + * + * @return string + */ + public function getSubAccountToType() + { + return $this->container['sub_account_to_type']; + } + + /** + * Sets sub_account_to_type + * + * @param string $sub_account_to_type Transfer to the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account + * + * @return $this + */ + public function setSubAccountToType($sub_account_to_type) + { + $allowedValues = $this->getSubAccountToTypeAllowableValues(); + if (!in_array($sub_account_to_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'sub_account_to_type', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['sub_account_to_type'] = $sub_account_to_type; + + return $this; + } + + /** + * Gets amount + * + * @return string + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string $amount Transfer amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SubAccountTransfer.php b/src/Model/SubAccountTransfer.php index 97c90bb..8e82988 100644 --- a/src/Model/SubAccountTransfer.php +++ b/src/Model/SubAccountTransfer.php @@ -42,17 +42,17 @@ class SubAccountTransfer implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'SubAccountTransfer'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'sub_account' => 'string', @@ -65,10 +65,10 @@ class SubAccountTransfer implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'sub_account' => null, @@ -194,6 +194,7 @@ public function getModelName() const DIRECTION_FROM = 'from'; const SUB_ACCOUNT_TYPE_SPOT = 'spot'; const SUB_ACCOUNT_TYPE_FUTURES = 'futures'; + const SUB_ACCOUNT_TYPE_CROSS_MARGIN = 'cross_margin'; @@ -220,6 +221,7 @@ public function getSubAccountTypeAllowableValues() return [ self::SUB_ACCOUNT_TYPE_SPOT, self::SUB_ACCOUNT_TYPE_FUTURES, + self::SUB_ACCOUNT_TYPE_CROSS_MARGIN, ]; } @@ -491,7 +493,7 @@ public function getSubAccountType() /** * Sets sub_account_type * - * @param string|null $sub_account_type Target sub user's account. `spot` - spot account, `futures` - perpetual contract account + * @param string|null $sub_account_type Target sub user's account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account * * @return $this */ @@ -517,7 +519,7 @@ public function setSubAccountType($sub_account_type) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -529,9 +531,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -542,7 +545,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -558,7 +561,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/SubCrossMarginAccount.php b/src/Model/SubCrossMarginAccount.php new file mode 100644 index 0000000..99b7b15 --- /dev/null +++ b/src/Model/SubCrossMarginAccount.php @@ -0,0 +1,755 @@ + 'int', + 'locked' => 'bool', + 'balances' => 'map[string,\GateApi\Model\CrossMarginBalance]', + 'total' => 'string', + 'borrowed' => 'string', + 'borrowed_net' => 'string', + 'net' => 'string', + 'leverage' => 'string', + 'interest' => 'string', + 'risk' => 'string', + 'total_initial_margin' => 'string', + 'total_margin_balance' => 'string', + 'total_maintenance_margin' => 'string', + 'total_initial_margin_rate' => 'string', + 'total_maintenance_margin_rate' => 'string', + 'total_available_margin' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'user_id' => 'int64', + 'locked' => null, + 'balances' => null, + 'total' => null, + 'borrowed' => null, + 'borrowed_net' => null, + 'net' => null, + 'leverage' => null, + 'interest' => null, + 'risk' => null, + 'total_initial_margin' => null, + 'total_margin_balance' => null, + 'total_maintenance_margin' => null, + 'total_initial_margin_rate' => null, + 'total_maintenance_margin_rate' => null, + 'total_available_margin' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'user_id' => 'user_id', + 'locked' => 'locked', + 'balances' => 'balances', + 'total' => 'total', + 'borrowed' => 'borrowed', + 'borrowed_net' => 'borrowed_net', + 'net' => 'net', + 'leverage' => 'leverage', + 'interest' => 'interest', + 'risk' => 'risk', + 'total_initial_margin' => 'total_initial_margin', + 'total_margin_balance' => 'total_margin_balance', + 'total_maintenance_margin' => 'total_maintenance_margin', + 'total_initial_margin_rate' => 'total_initial_margin_rate', + 'total_maintenance_margin_rate' => 'total_maintenance_margin_rate', + 'total_available_margin' => 'total_available_margin' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'user_id' => 'setUserId', + 'locked' => 'setLocked', + 'balances' => 'setBalances', + 'total' => 'setTotal', + 'borrowed' => 'setBorrowed', + 'borrowed_net' => 'setBorrowedNet', + 'net' => 'setNet', + 'leverage' => 'setLeverage', + 'interest' => 'setInterest', + 'risk' => 'setRisk', + 'total_initial_margin' => 'setTotalInitialMargin', + 'total_margin_balance' => 'setTotalMarginBalance', + 'total_maintenance_margin' => 'setTotalMaintenanceMargin', + 'total_initial_margin_rate' => 'setTotalInitialMarginRate', + 'total_maintenance_margin_rate' => 'setTotalMaintenanceMarginRate', + 'total_available_margin' => 'setTotalAvailableMargin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'user_id' => 'getUserId', + 'locked' => 'getLocked', + 'balances' => 'getBalances', + 'total' => 'getTotal', + 'borrowed' => 'getBorrowed', + 'borrowed_net' => 'getBorrowedNet', + 'net' => 'getNet', + 'leverage' => 'getLeverage', + 'interest' => 'getInterest', + 'risk' => 'getRisk', + 'total_initial_margin' => 'getTotalInitialMargin', + 'total_margin_balance' => 'getTotalMarginBalance', + 'total_maintenance_margin' => 'getTotalMaintenanceMargin', + 'total_initial_margin_rate' => 'getTotalInitialMarginRate', + 'total_maintenance_margin_rate' => 'getTotalMaintenanceMarginRate', + 'total_available_margin' => 'getTotalAvailableMargin' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['user_id'] = isset($data['user_id']) ? $data['user_id'] : null; + $this->container['locked'] = isset($data['locked']) ? $data['locked'] : null; + $this->container['balances'] = isset($data['balances']) ? $data['balances'] : null; + $this->container['total'] = isset($data['total']) ? $data['total'] : null; + $this->container['borrowed'] = isset($data['borrowed']) ? $data['borrowed'] : null; + $this->container['borrowed_net'] = isset($data['borrowed_net']) ? $data['borrowed_net'] : null; + $this->container['net'] = isset($data['net']) ? $data['net'] : null; + $this->container['leverage'] = isset($data['leverage']) ? $data['leverage'] : null; + $this->container['interest'] = isset($data['interest']) ? $data['interest'] : null; + $this->container['risk'] = isset($data['risk']) ? $data['risk'] : null; + $this->container['total_initial_margin'] = isset($data['total_initial_margin']) ? $data['total_initial_margin'] : null; + $this->container['total_margin_balance'] = isset($data['total_margin_balance']) ? $data['total_margin_balance'] : null; + $this->container['total_maintenance_margin'] = isset($data['total_maintenance_margin']) ? $data['total_maintenance_margin'] : null; + $this->container['total_initial_margin_rate'] = isset($data['total_initial_margin_rate']) ? $data['total_initial_margin_rate'] : null; + $this->container['total_maintenance_margin_rate'] = isset($data['total_maintenance_margin_rate']) ? $data['total_maintenance_margin_rate'] : null; + $this->container['total_available_margin'] = isset($data['total_available_margin']) ? $data['total_available_margin'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 user_id + * + * @return int|null + */ + public function getUserId() + { + return $this->container['user_id']; + } + + /** + * Sets user_id + * + * @param int|null $user_id User ID of the cross margin account. 0 means that the subaccount has not yet opened a cross margin account + * + * @return $this + */ + public function setUserId($user_id) + { + $this->container['user_id'] = $user_id; + + return $this; + } + + /** + * Gets locked + * + * @return bool|null + */ + public function getLocked() + { + return $this->container['locked']; + } + + /** + * Sets locked + * + * @param bool|null $locked Whether account is locked + * + * @return $this + */ + public function setLocked($locked) + { + $this->container['locked'] = $locked; + + return $this; + } + + /** + * Gets balances + * + * @return map[string,\GateApi\Model\CrossMarginBalance]|null + */ + public function getBalances() + { + return $this->container['balances']; + } + + /** + * Sets balances + * + * @param map[string,\GateApi\Model\CrossMarginBalance]|null $balances balances + * + * @return $this + */ + public function setBalances($balances) + { + $this->container['balances'] = $balances; + + return $this; + } + + /** + * Gets total + * + * @return string|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param string|null $total Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` + * + * @return $this + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets borrowed + * + * @return string|null + */ + public function getBorrowed() + { + return $this->container['borrowed']; + } + + /** + * Sets borrowed + * + * @param string|null $borrowed Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` + * + * @return $this + */ + public function setBorrowed($borrowed) + { + $this->container['borrowed'] = $borrowed; + + return $this; + } + + /** + * Gets borrowed_net + * + * @return string|null + */ + public function getBorrowedNet() + { + return $this->container['borrowed_net']; + } + + /** + * Sets borrowed_net + * + * @param string|null $borrowed_net Total borrowed value in USDT * borrowed factor + * + * @return $this + */ + public function setBorrowedNet($borrowed_net) + { + $this->container['borrowed_net'] = $borrowed_net; + + return $this; + } + + /** + * Gets net + * + * @return string|null + */ + public function getNet() + { + return $this->container['net']; + } + + /** + * Sets net + * + * @param string|null $net Total net assets in USDT + * + * @return $this + */ + public function setNet($net) + { + $this->container['net'] = $net; + + return $this; + } + + /** + * Gets leverage + * + * @return string|null + */ + public function getLeverage() + { + return $this->container['leverage']; + } + + /** + * Sets leverage + * + * @param string|null $leverage Position leverage + * + * @return $this + */ + public function setLeverage($leverage) + { + $this->container['leverage'] = $leverage; + + return $this; + } + + /** + * Gets interest + * + * @return string|null + */ + public function getInterest() + { + return $this->container['interest']; + } + + /** + * Sets interest + * + * @param string|null $interest Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` + * + * @return $this + */ + public function setInterest($interest) + { + $this->container['interest'] = $interest; + + return $this; + } + + /** + * Gets risk + * + * @return string|null + */ + public function getRisk() + { + return $this->container['risk']; + } + + /** + * Sets risk + * + * @param string|null $risk Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` + * + * @return $this + */ + public function setRisk($risk) + { + $this->container['risk'] = $risk; + + return $this; + } + + /** + * Gets total_initial_margin + * + * @return string|null + */ + public function getTotalInitialMargin() + { + return $this->container['total_initial_margin']; + } + + /** + * Sets total_initial_margin + * + * @param string|null $total_initial_margin Total initial margin + * + * @return $this + */ + public function setTotalInitialMargin($total_initial_margin) + { + $this->container['total_initial_margin'] = $total_initial_margin; + + return $this; + } + + /** + * Gets total_margin_balance + * + * @return string|null + */ + public function getTotalMarginBalance() + { + return $this->container['total_margin_balance']; + } + + /** + * Sets total_margin_balance + * + * @param string|null $total_margin_balance Total margin balance + * + * @return $this + */ + public function setTotalMarginBalance($total_margin_balance) + { + $this->container['total_margin_balance'] = $total_margin_balance; + + return $this; + } + + /** + * Gets total_maintenance_margin + * + * @return string|null + */ + public function getTotalMaintenanceMargin() + { + return $this->container['total_maintenance_margin']; + } + + /** + * Sets total_maintenance_margin + * + * @param string|null $total_maintenance_margin Total maintenance margin + * + * @return $this + */ + public function setTotalMaintenanceMargin($total_maintenance_margin) + { + $this->container['total_maintenance_margin'] = $total_maintenance_margin; + + return $this; + } + + /** + * Gets total_initial_margin_rate + * + * @return string|null + */ + public function getTotalInitialMarginRate() + { + return $this->container['total_initial_margin_rate']; + } + + /** + * Sets total_initial_margin_rate + * + * @param string|null $total_initial_margin_rate Total initial margin rate + * + * @return $this + */ + public function setTotalInitialMarginRate($total_initial_margin_rate) + { + $this->container['total_initial_margin_rate'] = $total_initial_margin_rate; + + return $this; + } + + /** + * Gets total_maintenance_margin_rate + * + * @return string|null + */ + public function getTotalMaintenanceMarginRate() + { + return $this->container['total_maintenance_margin_rate']; + } + + /** + * Sets total_maintenance_margin_rate + * + * @param string|null $total_maintenance_margin_rate Total maintenance margin rate + * + * @return $this + */ + public function setTotalMaintenanceMarginRate($total_maintenance_margin_rate) + { + $this->container['total_maintenance_margin_rate'] = $total_maintenance_margin_rate; + + return $this; + } + + /** + * Gets total_available_margin + * + * @return string|null + */ + public function getTotalAvailableMargin() + { + return $this->container['total_available_margin']; + } + + /** + * Sets total_available_margin + * + * @param string|null $total_available_margin Total available margin + * + * @return $this + */ + public function setTotalAvailableMargin($total_available_margin) + { + $this->container['total_available_margin'] = $total_available_margin; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SystemTime.php b/src/Model/SystemTime.php new file mode 100644 index 0000000..a8610df --- /dev/null +++ b/src/Model/SystemTime.php @@ -0,0 +1,305 @@ + 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'server_time' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'server_time' => 'server_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'server_time' => 'setServerTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'server_time' => 'getServerTime' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['server_time'] = isset($data['server_time']) ? $data['server_time'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 server_time + * + * @return int|null + */ + public function getServerTime() + { + return $this->container['server_time']; + } + + /** + * Sets server_time + * + * @param int|null $server_time Server current time(ms) + * + * @return $this + */ + public function setServerTime($server_time) + { + $this->container['server_time'] = $server_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Ticker.php b/src/Model/Ticker.php index 0568867..0643706 100644 --- a/src/Model/Ticker.php +++ b/src/Model/Ticker.php @@ -42,23 +42,25 @@ class Ticker implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Ticker'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency_pair' => 'string', 'last' => 'string', 'lowest_ask' => 'string', 'highest_bid' => 'string', 'change_percentage' => 'string', + 'change_utc0' => 'string', + 'change_utc8' => 'string', 'base_volume' => 'string', 'quote_volume' => 'string', 'high_24h' => 'string', @@ -70,16 +72,18 @@ class Ticker implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency_pair' => null, 'last' => null, 'lowest_ask' => null, 'highest_bid' => null, 'change_percentage' => null, + 'change_utc0' => null, + 'change_utc8' => null, 'base_volume' => null, 'quote_volume' => null, 'high_24h' => null, @@ -122,6 +126,8 @@ public static function openAPIFormats() 'lowest_ask' => 'lowest_ask', 'highest_bid' => 'highest_bid', 'change_percentage' => 'change_percentage', + 'change_utc0' => 'change_utc0', + 'change_utc8' => 'change_utc8', 'base_volume' => 'base_volume', 'quote_volume' => 'quote_volume', 'high_24h' => 'high_24h', @@ -143,6 +149,8 @@ public static function openAPIFormats() 'lowest_ask' => 'setLowestAsk', 'highest_bid' => 'setHighestBid', 'change_percentage' => 'setChangePercentage', + 'change_utc0' => 'setChangeUtc0', + 'change_utc8' => 'setChangeUtc8', 'base_volume' => 'setBaseVolume', 'quote_volume' => 'setQuoteVolume', 'high_24h' => 'setHigh24h', @@ -164,6 +172,8 @@ public static function openAPIFormats() 'lowest_ask' => 'getLowestAsk', 'highest_bid' => 'getHighestBid', 'change_percentage' => 'getChangePercentage', + 'change_utc0' => 'getChangeUtc0', + 'change_utc8' => 'getChangeUtc8', 'base_volume' => 'getBaseVolume', 'quote_volume' => 'getQuoteVolume', 'high_24h' => 'getHigh24h', @@ -239,6 +249,8 @@ public function __construct(array $data = null) $this->container['lowest_ask'] = isset($data['lowest_ask']) ? $data['lowest_ask'] : null; $this->container['highest_bid'] = isset($data['highest_bid']) ? $data['highest_bid'] : null; $this->container['change_percentage'] = isset($data['change_percentage']) ? $data['change_percentage'] : null; + $this->container['change_utc0'] = isset($data['change_utc0']) ? $data['change_utc0'] : null; + $this->container['change_utc8'] = isset($data['change_utc8']) ? $data['change_utc8'] : null; $this->container['base_volume'] = isset($data['base_volume']) ? $data['base_volume'] : null; $this->container['quote_volume'] = isset($data['quote_volume']) ? $data['quote_volume'] : null; $this->container['high_24h'] = isset($data['high_24h']) ? $data['high_24h'] : null; @@ -334,7 +346,7 @@ public function getLowestAsk() /** * Sets lowest_ask * - * @param string|null $lowest_ask Lowest ask + * @param string|null $lowest_ask Recent lowest ask * * @return $this */ @@ -358,7 +370,7 @@ public function getHighestBid() /** * Sets highest_bid * - * @param string|null $highest_bid Highest bid + * @param string|null $highest_bid Recent highest bid * * @return $this */ @@ -382,7 +394,7 @@ public function getChangePercentage() /** * Sets change_percentage * - * @param string|null $change_percentage Change percentage. + * @param string|null $change_percentage Change percentage in the last 24h * * @return $this */ @@ -393,6 +405,54 @@ public function setChangePercentage($change_percentage) return $this; } + /** + * Gets change_utc0 + * + * @return string|null + */ + public function getChangeUtc0() + { + return $this->container['change_utc0']; + } + + /** + * Sets change_utc0 + * + * @param string|null $change_utc0 utc0 timezone, the percentage change in the last 24 hours + * + * @return $this + */ + public function setChangeUtc0($change_utc0) + { + $this->container['change_utc0'] = $change_utc0; + + return $this; + } + + /** + * Gets change_utc8 + * + * @return string|null + */ + public function getChangeUtc8() + { + return $this->container['change_utc8']; + } + + /** + * Sets change_utc8 + * + * @param string|null $change_utc8 utc8 timezone, the percentage change in the last 24 hours + * + * @return $this + */ + public function setChangeUtc8($change_utc8) + { + $this->container['change_utc8'] = $change_utc8; + + return $this; + } + /** * Gets base_volume * @@ -406,7 +466,7 @@ public function getBaseVolume() /** * Sets base_volume * - * @param string|null $base_volume Base currency trade volume + * @param string|null $base_volume Base currency trade volume in the last 24h * * @return $this */ @@ -430,7 +490,7 @@ public function getQuoteVolume() /** * Sets quote_volume * - * @param string|null $quote_volume Quote currency trade volume + * @param string|null $quote_volume Quote currency trade volume in the last 24h * * @return $this */ @@ -591,7 +651,7 @@ public function setEtfLeverage($etf_leverage) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -603,9 +663,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -616,7 +677,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -632,7 +693,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/TotalBalance.php b/src/Model/TotalBalance.php new file mode 100644 index 0000000..edd256b --- /dev/null +++ b/src/Model/TotalBalance.php @@ -0,0 +1,336 @@ + '\GateApi\Model\AccountBalance', + 'details' => 'map[string,\GateApi\Model\AccountBalance]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'total' => null, + 'details' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'total' => 'total', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'details' => 'getDetails' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['total'] = isset($data['total']) ? $data['total'] : null; + $this->container['details'] = isset($data['details']) ? $data['details'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 total + * + * @return \GateApi\Model\AccountBalance|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param \GateApi\Model\AccountBalance|null $total total + * + * @return $this + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets details + * + * @return map[string,\GateApi\Model\AccountBalance]|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param map[string,\GateApi\Model\AccountBalance]|null $details Total balances in different accounts - cross_margin: cross margin account - spot: spot account - finance: finance account - margin: margin account - quant: quant account - futures: futures account - delivery: delivery account - warrant: warrant account - cbbc: cbbc account + * + * @return $this + */ + public function setDetails($details) + { + $this->container['details'] = $details; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Trade.php b/src/Model/Trade.php index 6503a24..a76af44 100644 --- a/src/Model/Trade.php +++ b/src/Model/Trade.php @@ -42,21 +42,22 @@ class Trade implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Trade'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'create_time' => 'string', 'create_time_ms' => 'string', + 'currency_pair' => 'string', 'side' => 'string', 'role' => 'string', 'amount' => 'string', @@ -69,14 +70,15 @@ class Trade implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => null, 'create_time' => null, 'create_time_ms' => null, + 'currency_pair' => null, 'side' => null, 'role' => null, 'amount' => null, @@ -118,6 +120,7 @@ public static function openAPIFormats() 'id' => 'id', 'create_time' => 'create_time', 'create_time_ms' => 'create_time_ms', + 'currency_pair' => 'currency_pair', 'side' => 'side', 'role' => 'role', 'amount' => 'amount', @@ -138,6 +141,7 @@ public static function openAPIFormats() 'id' => 'setId', 'create_time' => 'setCreateTime', 'create_time_ms' => 'setCreateTimeMs', + 'currency_pair' => 'setCurrencyPair', 'side' => 'setSide', 'role' => 'setRole', 'amount' => 'setAmount', @@ -158,6 +162,7 @@ public static function openAPIFormats() 'id' => 'getId', 'create_time' => 'getCreateTime', 'create_time_ms' => 'getCreateTimeMs', + 'currency_pair' => 'getCurrencyPair', 'side' => 'getSide', 'role' => 'getRole', 'amount' => 'getAmount', @@ -262,6 +267,7 @@ public function __construct(array $data = null) $this->container['id'] = isset($data['id']) ? $data['id'] : null; $this->container['create_time'] = isset($data['create_time']) ? $data['create_time'] : null; $this->container['create_time_ms'] = isset($data['create_time_ms']) ? $data['create_time_ms'] : null; + $this->container['currency_pair'] = isset($data['currency_pair']) ? $data['currency_pair'] : null; $this->container['side'] = isset($data['side']) ? $data['side'] : null; $this->container['role'] = isset($data['role']) ? $data['role'] : null; $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; @@ -385,6 +391,30 @@ public function setCreateTimeMs($create_time_ms) return $this; } + /** + * Gets currency_pair + * + * @return string|null + */ + public function getCurrencyPair() + { + return $this->container['currency_pair']; + } + + /** + * Sets currency_pair + * + * @param string|null $currency_pair Currency pair + * + * @return $this + */ + public function setCurrencyPair($currency_pair) + { + $this->container['currency_pair'] = $currency_pair; + + return $this; + } + /** * Gets side * @@ -431,7 +461,7 @@ public function getRole() /** * Sets role * - * @param string|null $role Trade role + * @param string|null $role Trade role. No value in public endpoints * * @return $this */ @@ -584,7 +614,7 @@ public function getPointFee() /** * Sets point_fee * - * @param string|null $point_fee Point used to deduct fee + * @param string|null $point_fee Points used to deduct fee. No value in public endpoints * * @return $this */ @@ -608,7 +638,7 @@ public function getGtFee() /** * Sets gt_fee * - * @param string|null $gt_fee GT used to deduct fee + * @param string|null $gt_fee GT used to deduct fee. No value in public endpoints * * @return $this */ @@ -625,7 +655,7 @@ public function setGtFee($gt_fee) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -637,9 +667,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -650,7 +681,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -666,7 +697,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/TradeFee.php b/src/Model/TradeFee.php index e1a5ad1..1b77501 100644 --- a/src/Model/TradeFee.php +++ b/src/Model/TradeFee.php @@ -42,17 +42,17 @@ class TradeFee implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'TradeFee'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'user_id' => 'int', 'taker_fee' => 'string', @@ -67,10 +67,10 @@ class TradeFee implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'user_id' => 'int64', 'taker_fee' => null, @@ -340,7 +340,7 @@ public function getGtDiscount() /** * Sets gt_discount * - * @param bool|null $gt_discount Is GT deduction is enabled + * @param bool|null $gt_discount If GT deduction is enabled * * @return $this */ @@ -501,7 +501,7 @@ public function setFuturesMakerFee($futures_maker_fee) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -513,9 +513,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -526,7 +527,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -542,7 +543,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/TransactionID.php b/src/Model/TransactionID.php new file mode 100644 index 0000000..4e6ef97 --- /dev/null +++ b/src/Model/TransactionID.php @@ -0,0 +1,305 @@ + 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'tx_id' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'tx_id' => 'tx_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'tx_id' => 'setTxId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'tx_id' => 'getTxId' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['tx_id'] = isset($data['tx_id']) ? $data['tx_id'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 tx_id + * + * @return int|null + */ + public function getTxId() + { + return $this->container['tx_id']; + } + + /** + * Sets tx_id + * + * @param int|null $tx_id Order id + * + * @return $this + */ + public function setTxId($tx_id) + { + $this->container['tx_id'] = $tx_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Transfer.php b/src/Model/Transfer.php index 4e76650..ea49317 100644 --- a/src/Model/Transfer.php +++ b/src/Model/Transfer.php @@ -33,7 +33,7 @@ * Transfer Class Doc Comment * * @category Class - * @description Accounts available to transfer: - `spot`: spot account - `margin`: margin account - `futures`: perpetual futures account - `delivery`: delivery futures account - `cross_margin`: cross margin account + * @description Accounts available to transfer: - `spot`: spot account - `margin`: margin account - `futures`: perpetual futures account - `delivery`: delivery futures account - `cross_margin`: cross margin account - `options`: options account * @package GateApi * @author GateIO * @link https://www.gate.io @@ -43,17 +43,17 @@ class Transfer implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Transfer'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'from' => 'string', @@ -64,10 +64,10 @@ class Transfer implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'from' => null, @@ -186,11 +186,13 @@ public function getModelName() const FROM_FUTURES = 'futures'; const FROM_DELIVERY = 'delivery'; const FROM_CROSS_MARGIN = 'cross_margin'; + const FROM_OPTIONS = 'options'; const TO_SPOT = 'spot'; const TO_MARGIN = 'margin'; const TO_FUTURES = 'futures'; const TO_DELIVERY = 'delivery'; const TO_CROSS_MARGIN = 'cross_margin'; + const TO_OPTIONS = 'options'; @@ -207,6 +209,7 @@ public function getFromAllowableValues() self::FROM_FUTURES, self::FROM_DELIVERY, self::FROM_CROSS_MARGIN, + self::FROM_OPTIONS, ]; } @@ -223,6 +226,7 @@ public function getToAllowableValues() self::TO_FUTURES, self::TO_DELIVERY, self::TO_CROSS_MARGIN, + self::TO_OPTIONS, ]; } @@ -339,7 +343,7 @@ public function getFrom() /** * Sets from * - * @param string $from Account transferred from + * @param string $from Account to transfer from * * @return $this */ @@ -372,7 +376,7 @@ public function getTo() /** * Sets to * - * @param string $to Account transferred to + * @param string $to Account to transfer to * * @return $this */ @@ -453,7 +457,7 @@ public function getSettle() /** * Sets settle * - * @param string|null $settle Futures settle currency. Required if `currency` is `POINT` + * @param string|null $settle Futures settle currency. Required if transferring from or to futures account * * @return $this */ @@ -470,7 +474,7 @@ public function setSettle($settle) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -482,9 +486,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -495,7 +500,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -511,7 +516,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/TriggerOrderResponse.php b/src/Model/TriggerOrderResponse.php index 3241d7c..1734271 100644 --- a/src/Model/TriggerOrderResponse.php +++ b/src/Model/TriggerOrderResponse.php @@ -42,26 +42,26 @@ class TriggerOrderResponse implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'TriggerOrderResponse'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'id' => 'int64' ]; @@ -231,7 +231,7 @@ public function setId($id) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -243,9 +243,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -256,7 +257,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -272,7 +273,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/Model/TriggerTime.php b/src/Model/TriggerTime.php new file mode 100644 index 0000000..c05c59f --- /dev/null +++ b/src/Model/TriggerTime.php @@ -0,0 +1,305 @@ + 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'trigger_time' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'trigger_time' => 'triggerTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'trigger_time' => 'setTriggerTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'trigger_time' => 'getTriggerTime' + ]; + + /** + * 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::$openAPIModelName; + } + + + + + + /** + * 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['trigger_time'] = isset($data['trigger_time']) ? $data['trigger_time'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + 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 trigger_time + * + * @return int|null + */ + public function getTriggerTime() + { + return $this->container['trigger_time']; + } + + /** + * Sets trigger_time + * + * @param int|null $trigger_time Timestamp of the end of the countdown, in milliseconds + * + * @return $this + */ + public function setTriggerTime($trigger_time) + { + $this->container['trigger_time'] = $trigger_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/WithdrawStatus.php b/src/Model/WithdrawStatus.php index bce2d0b..c108caf 100644 --- a/src/Model/WithdrawStatus.php +++ b/src/Model/WithdrawStatus.php @@ -42,17 +42,17 @@ class WithdrawStatus implements ModelInterface, ArrayAccess const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'WithdrawStatus'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'currency' => 'string', 'name' => 'string', @@ -63,14 +63,15 @@ class WithdrawStatus implements ModelInterface, ArrayAccess 'withdraw_day_limit' => 'string', 'withdraw_amount_mini' => 'string', 'withdraw_day_limit_remain' => 'string', - 'withdraw_eachtime_limit' => 'string' + 'withdraw_eachtime_limit' => 'string', + 'withdraw_fix_on_chains' => 'map[string,string]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPIFormats = [ 'currency' => null, 'name' => null, @@ -81,7 +82,8 @@ class WithdrawStatus implements ModelInterface, ArrayAccess 'withdraw_day_limit' => null, 'withdraw_amount_mini' => null, 'withdraw_day_limit_remain' => null, - 'withdraw_eachtime_limit' => null + 'withdraw_eachtime_limit' => null, + 'withdraw_fix_on_chains' => null ]; /** @@ -120,7 +122,8 @@ public static function openAPIFormats() 'withdraw_day_limit' => 'withdraw_day_limit', 'withdraw_amount_mini' => 'withdraw_amount_mini', 'withdraw_day_limit_remain' => 'withdraw_day_limit_remain', - 'withdraw_eachtime_limit' => 'withdraw_eachtime_limit' + 'withdraw_eachtime_limit' => 'withdraw_eachtime_limit', + 'withdraw_fix_on_chains' => 'withdraw_fix_on_chains' ]; /** @@ -138,7 +141,8 @@ public static function openAPIFormats() 'withdraw_day_limit' => 'setWithdrawDayLimit', 'withdraw_amount_mini' => 'setWithdrawAmountMini', 'withdraw_day_limit_remain' => 'setWithdrawDayLimitRemain', - 'withdraw_eachtime_limit' => 'setWithdrawEachtimeLimit' + 'withdraw_eachtime_limit' => 'setWithdrawEachtimeLimit', + 'withdraw_fix_on_chains' => 'setWithdrawFixOnChains' ]; /** @@ -156,7 +160,8 @@ public static function openAPIFormats() 'withdraw_day_limit' => 'getWithdrawDayLimit', 'withdraw_amount_mini' => 'getWithdrawAmountMini', 'withdraw_day_limit_remain' => 'getWithdrawDayLimitRemain', - 'withdraw_eachtime_limit' => 'getWithdrawEachtimeLimit' + 'withdraw_eachtime_limit' => 'getWithdrawEachtimeLimit', + 'withdraw_fix_on_chains' => 'getWithdrawFixOnChains' ]; /** @@ -229,6 +234,7 @@ public function __construct(array $data = null) $this->container['withdraw_amount_mini'] = isset($data['withdraw_amount_mini']) ? $data['withdraw_amount_mini'] : null; $this->container['withdraw_day_limit_remain'] = isset($data['withdraw_day_limit_remain']) ? $data['withdraw_day_limit_remain'] : null; $this->container['withdraw_eachtime_limit'] = isset($data['withdraw_eachtime_limit']) ? $data['withdraw_eachtime_limit'] : null; + $this->container['withdraw_fix_on_chains'] = isset($data['withdraw_fix_on_chains']) ? $data['withdraw_fix_on_chains'] : null; } /** @@ -494,6 +500,30 @@ public function setWithdrawEachtimeLimit($withdraw_eachtime_limit) return $this; } + + /** + * Gets withdraw_fix_on_chains + * + * @return map[string,string]|null + */ + public function getWithdrawFixOnChains() + { + return $this->container['withdraw_fix_on_chains']; + } + + /** + * Sets withdraw_fix_on_chains + * + * @param map[string,string]|null $withdraw_fix_on_chains Fixed withdrawal fee on multiple chains + * + * @return $this + */ + public function setWithdrawFixOnChains($withdraw_fix_on_chains) + { + $this->container['withdraw_fix_on_chains'] = $withdraw_fix_on_chains; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -501,7 +531,7 @@ public function setWithdrawEachtimeLimit($withdraw_eachtime_limit) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -513,9 +543,10 @@ public function offsetExists($offset) * * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return $this->container[$offset] ?? null; } /** @@ -526,7 +557,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -542,7 +573,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index 1b7288c..92de72d 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -39,8 +39,8 @@ class ObjectSerializer { /** - * @var string -*/ + * @var string + */ private static $dateTimeFormat = \DateTime::ATOM; /** @@ -214,7 +214,7 @@ public static function toString($value) * * @param array $collection collection to serialize to a string * @param string $style the format use for serialization (csv, - * ssv, tsv, pipes, multi) + * ssv, tsv, pipes, multi) * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array * * @return string