haskell-bitmex-rest (empty) → 0.1.0.0
raw patch · 17 files changed
+18293/−0 lines, 17 filesdep +QuickCheckdep +aesondep +basesetup-changed
Dependencies added: QuickCheck, aeson, base, base64-bytestring, bytestring, case-insensitive, containers, deepseq, exceptions, haskell-bitmex-rest, hspec, http-api-data, http-client, http-client-tls, http-media, http-types, iso8601-time, katip, microlens, mtl, network, random, safe-exceptions, semigroups, text, time, transformers, unordered-containers, vector
Files
- LICENSE +30/−0
- README.md +196/−0
- Setup.hs +2/−0
- haskell-bitmex-rest.cabal +99/−0
- lib/BitMEX.hs +32/−0
- lib/BitMEX/API.hs +3716/−0
- lib/BitMEX/Client.hs +218/−0
- lib/BitMEX/Core.hs +545/−0
- lib/BitMEX/Logging.hs +118/−0
- lib/BitMEX/MimeTypes.hs +202/−0
- lib/BitMEX/Model.hs +3213/−0
- lib/BitMEX/ModelLens.hs +2871/−0
- swagger.yaml +6077/−0
- tests/ApproxEq.hs +81/−0
- tests/Instances.hs +782/−0
- tests/PropMime.hs +51/−0
- tests/Test.hs +60/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2018, Lucsanszky++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Lucsanszky nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,196 @@+## Swagger Auto-Generated [http-client](https://www.stackage.org/lts-9.0/package/http-client-0.5.7.0) Bindings to `BitMEX` ++The library in `lib` provides auto-generated-from-Swagger [http-client](https://www.stackage.org/lts-9.0/package/http-client-0.5.7.0) bindings to the BitMEX API.++Targeted swagger version: 2.0++OpenAPI-Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md++## Installation++Installation follows the standard approach to installing Stack-based projects.++1. Install the [Haskell `stack` tool](http://docs.haskellstack.org/en/stable/README).+2. To build the package, and generate the documentation (recommended):+```+stack haddock+```+which will generate docs for this lib in the `docs` folder.++To generate the docs in the normal location (to enable hyperlinks to external libs), remove +```+build:+ haddock-arguments:+ haddock-args:+ - "--odir=./docs"+```+from the stack.yaml file and run `stack haddock` again.++3. To run unit tests:+```+stack test+```++## Swagger-Codegen++The code generator that produced this library, and which explains how+to obtain and use the swagger-codegen cli tool lives at++https://github.com/swagger-api/swagger-codegen++The _language_ argument (`--lang`) passed to the cli tool used should be ++```+haskell-http-client+```++### Unsupported Swagger Features++* Model Inheritance++This is beta software; other cases may not be supported.++### Codegen "additional properties" parameters++These options allow some customization of the code generation process.++**haskell-http-client additional properties:**++| OPTION | DESCRIPTION | DEFAULT | ACTUAL |+| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |+| allowFromJsonNulls | allow JSON Null during model decoding from JSON | true | true |+| allowToJsonNulls | allow emitting JSON Null during model encoding to JSON | false | false |+| dateFormat | format string used to parse/render a date | %Y-%m-%d | %Y-%m-%d |+| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | |+| generateEnums | Generate specific datatypes for swagger enums | true | true |+| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | true |+| generateLenses | Generate Lens optics for Models | true | true |+| generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | true |+| inlineMimeTypes | Inline (hardcode) the content-type and accept parameters on operations, when there is only 1 option | false | false |+| modelDeriving | Additional classes to include in the deriving() clause of Models | | |+| strictFields | Add strictness annotations to all model fields | true | true |+| useMonadLogger | Use the monad-logger package to provide logging (if instead false, use the katip logging package) | false | false |++[1]: https://www.stackage.org/haddock/lts-9.0/iso8601-time-0.1.4/Data-Time-ISO8601.html#v:formatISO8601Millis++An example setting _strictFields_ and _dateTimeFormat_:++```+java -jar swagger-codegen-cli.jar generate -i petstore.yaml -l haskell-http-client -o output/haskell-http-client -DstrictFields=true -DdateTimeFormat="%Y-%m-%dT%H:%M:%S%Q%z"+```++View the full list of Codegen "config option" parameters with the command:++```+java -jar swagger-codegen-cli.jar config-help -l haskell-http-client+```++## Usage Notes++### Example SwaggerPetstore Haddock documentation ++An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (SwaggerPetstore) can be found [here][2]++[2]: https://hackage.haskell.org/package/swagger-petstore++### Example SwaggerPetstore App++An example application using the auto-generated haskell-http-client bindings for the server http://petstore.swagger.io/ can be found [here][3]++[3]: https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/haskell-http-client/example-app++This library is intended to be imported qualified.++### Modules++| MODULE | NOTES |+| ------------------- | --------------------------------------------------- |+| BitMEX.Client | use the "dispatch" functions to send requests |+| BitMEX.Core | core funcions, config and request types |+| BitMEX.API | construct api requests |+| BitMEX.Model | describes api models |+| BitMEX.MimeTypes | encoding/decoding MIME types (content-types/accept) |+| BitMEX.ModelLens | lenses for model fields |+| BitMEX.Logging | logging functions and utils |+++### MimeTypes++This library adds type safety around what swagger specifies as+Produces and Consumes for each Operation (e.g. the list of MIME types an+Operation can Produce (using 'accept' headers) and Consume (using 'content-type' headers).++For example, if there is an Operation named _addFoo_, there will be a+data type generated named _AddFoo_ (note the capitalization), which+describes additional constraints and actions on the _addFoo_ operation+via its typeclass instances. These typeclass instances can be viewed+in GHCi or via the Haddocks.++* required parameters are included as function arguments to _addFoo_+* optional non-body parameters are included by using `applyOptionalParam`+* optional body parameters are set by using `setBodyParam`++Example code generated for pretend _addFoo_ operation: ++```haskell+data AddFoo +instance Consumes AddFoo MimeJSON+instance Produces AddFoo MimeJSON+instance Produces AddFoo MimeXML+instance HasBodyParam AddFoo FooModel+instance HasOptionalParam AddFoo FooName+instance HasOptionalParam AddFoo FooId+```++this would indicate that:++* the _addFoo_ operation can consume JSON+* the _addFoo_ operation produces JSON or XML, depending on the argument passed to the dispatch function+* the _addFoo_ operation can set it's body param of _FooModel_ via `setBodyParam`+* the _addFoo_ operation can set 2 different optional parameters via `applyOptionalParam`++If the swagger spec doesn't declare it can accept or produce a certain+MIME type for a given Operation, you should either add a Produces or+Consumes instance for the desired MIME types (assuming the server+supports it), use `dispatchLbsUnsafe` or modify the swagger spec and+run the generator again.++New MIME type instances can be added via MimeType/MimeRender/MimeUnrender++Only JSON instances are generated by default, and in some case+x-www-form-urlencoded instances (FromFrom, ToForm) will also be+generated if the model fields are primitive types, and there are+Operations using x-www-form-urlencoded which use those models.++### Authentication++A haskell data type will be generated for each swagger authentication type.++If for example the AuthMethod `AuthOAuthFoo` is generated for OAuth operations, then+`addAuthMethod` should be used to add the AuthMethod config.++When a request is dispatched, if a matching auth method is found in+the config, it will be applied to the request.++### Example++```haskell+mgr <- newManager defaultManagerSettings+config0 <- withStdoutLogging =<< newConfig +let config = config0+ `addAuthMethod` AuthOAuthFoo "secret-key"++let addFooRequest = + addFoo + (ContentType MimeJSON) + (Accept MimeXML) + (ParamBar paramBar)+ (ParamQux paramQux)+ modelBaz+ `applyOptionalParam` FooId 1+ `applyOptionalParam` FooName "name"+ `setHeader` [("qux_header","xxyy")]+addFooResult <- dispatchMime mgr config addFooRequest+```++See the example app and the haddocks for details.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ haskell-bitmex-rest.cabal view
@@ -0,0 +1,99 @@+name: haskell-bitmex-rest+version: 0.1.0.0+synopsis: Auto-generated bitmex API Client+description: .+ Client library for calling the bitmex API based on http-client.+ .+ host:+ .+ base path: https://localhost/api/v1+ .+ BitMEX API API version: 1.2.0+ .+ OpenAPI spec version: 2.0+ .+ OpenAPI-Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md+ .+category: Web+homepage: https://github.com/swagger-api/swagger-codegen#readme, https://github.com/Lucsanszky/haskell-bitmex/tree/master/rest+author: Lucsanszky+maintainer: dan.lucsanszky@gmail.com+license: BSD3+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10++extra-source-files:+ README.md+ swagger.yaml++library+ hs-source-dirs:+ lib+ ghc-options: -Wall -funbox-strict-fields+ build-depends:+ base >=4.7 && <5.0+ , transformers >=0.4.0.0+ , mtl >=2.2.1+ , unordered-containers+ , aeson >=1.0 && <2.0+ , bytestring >=0.10.0 && <0.11+ , base64-bytestring >1.0 && <2.0+ , containers >=0.5.0.0 && <0.6+ , http-types >=0.8 && <0.11+ , http-client >=0.5 && <0.6+ , http-client-tls+ , http-api-data >= 0.3.4 && <0.4+ , http-media >= 0.4 && < 0.8+ , text >=0.11 && <1.3+ , time >=1.5 && <1.9+ , iso8601-time >=0.1.3 && <0.2.0+ , vector >=0.10.9 && <0.13+ , network >=2.6.2 && <2.7+ , random >=1.1+ , exceptions >= 0.4+ , katip >=0.4 && < 0.6+ , safe-exceptions <0.2+ , case-insensitive+ , microlens >= 0.4.3 && <0.5+ , deepseq >= 1.4 && <1.6+ exposed-modules:+ BitMEX+ BitMEX.API+ BitMEX.Client+ BitMEX.Core+ BitMEX.Logging+ BitMEX.MimeTypes+ BitMEX.Model+ BitMEX.ModelLens+ other-modules:+ Paths_haskell_bitmex_rest+ default-language: Haskell2010++test-suite tests+ type: exitcode-stdio-1.0+ main-is: Test.hs+ hs-source-dirs:+ tests+ ghc-options: -Wall -fno-warn-orphans+ build-depends:+ base >=4.7 && <5.0+ , transformers >=0.4.0.0+ , mtl >=2.2.1+ , unordered-containers+ , haskell-bitmex-rest+ , bytestring >=0.10.0 && <0.11+ , containers+ , hspec >=1.8+ , text+ , time+ , iso8601-time+ , aeson+ , vector+ , semigroups+ , QuickCheck+ other-modules:+ ApproxEq+ Instances+ PropMime+ default-language: Haskell2010
+ lib/BitMEX.hs view
@@ -0,0 +1,32 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. ++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX+-}++module BitMEX+ ( module BitMEX.API+ , module BitMEX.Client+ , module BitMEX.Core+ , module BitMEX.Logging+ , module BitMEX.MimeTypes+ , module BitMEX.Model+ , module BitMEX.ModelLens+ ) where++import BitMEX.API+import BitMEX.Client+import BitMEX.Core+import BitMEX.Logging+import BitMEX.MimeTypes+import BitMEX.Model+import BitMEX.ModelLens
+ lib/BitMEX/API.hs view
@@ -0,0 +1,3716 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. ++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.API+-}++{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE InstanceSigs #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}++module BitMEX.API where++import BitMEX.Core+import BitMEX.MimeTypes+import BitMEX.Model as M++import qualified Data.Aeson as A+import qualified Data.ByteString as B+import qualified Data.ByteString.Base64 as B64+import qualified Data.ByteString.Char8 as BC+import qualified Data.ByteString.Lazy as BL+import qualified Data.Data as P (Typeable, TypeRep, typeOf, typeRep)+import qualified Data.Foldable as P+import qualified Data.Map as Map+import qualified Data.Maybe as P+import qualified Data.Proxy as P (Proxy(..))+import qualified Data.Set as Set+import qualified Data.String as P+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TL+import qualified Data.Time as TI+import qualified GHC.Base as P (Alternative)+import qualified Lens.Micro as L+import qualified Network.HTTP.Client.MultipartFormData as NH+import qualified Network.HTTP.Media as ME+import qualified Network.HTTP.Types as NH+import qualified Web.FormUrlEncoded as WH+import qualified Web.HttpApiData as WH++import Data.Monoid ((<>))+import Data.Function ((&))+import Data.Text (Text)+import GHC.Base ((<|>))++import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)+import qualified Prelude as P++-- * Operations+++-- ** APIKey++-- *** aPIKeyDisable++-- | @POST \/apiKey\/disable@+-- +-- Disable an API Key.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +aPIKeyDisable + :: (Consumes APIKeyDisable contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> ApiKeyId -- ^ "apiKeyId" - API Key ID (public component).+ -> BitMEXRequest APIKeyDisable contentType APIKey accept+aPIKeyDisable _ _ (ApiKeyId apiKeyId) =+ _mkRequest "POST" ["/apiKey/disable"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("apiKeyID", apiKeyId)++data APIKeyDisable ++-- | @application/json@+instance Consumes APIKeyDisable MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes APIKeyDisable MimeFormUrlEncoded++-- | @application/json@+instance Produces APIKeyDisable MimeJSON+-- | @application/xml@+instance Produces APIKeyDisable MimeXML+-- | @text/xml@+instance Produces APIKeyDisable MimeTextxml+-- | @application/javascript@+instance Produces APIKeyDisable MimeJavascript+-- | @text/javascript@+instance Produces APIKeyDisable MimeTextjavascript+++-- *** aPIKeyEnable++-- | @POST \/apiKey\/enable@+-- +-- Enable an API Key.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +aPIKeyEnable + :: (Consumes APIKeyEnable contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> ApiKeyId -- ^ "apiKeyId" - API Key ID (public component).+ -> BitMEXRequest APIKeyEnable contentType APIKey accept+aPIKeyEnable _ _ (ApiKeyId apiKeyId) =+ _mkRequest "POST" ["/apiKey/enable"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("apiKeyID", apiKeyId)++data APIKeyEnable ++-- | @application/json@+instance Consumes APIKeyEnable MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes APIKeyEnable MimeFormUrlEncoded++-- | @application/json@+instance Produces APIKeyEnable MimeJSON+-- | @application/xml@+instance Produces APIKeyEnable MimeXML+-- | @text/xml@+instance Produces APIKeyEnable MimeTextxml+-- | @application/javascript@+instance Produces APIKeyEnable MimeJavascript+-- | @text/javascript@+instance Produces APIKeyEnable MimeTextjavascript+++-- *** aPIKeyGet++-- | @GET \/apiKey@+-- +-- Get your API Keys.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +aPIKeyGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest APIKeyGet MimeNoContent [APIKey] accept+aPIKeyGet _ =+ _mkRequest "GET" ["/apiKey"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data APIKeyGet ++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam APIKeyGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | @application/json@+instance Consumes APIKeyGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes APIKeyGet MimeFormUrlEncoded++-- | @application/json@+instance Produces APIKeyGet MimeJSON+-- | @application/xml@+instance Produces APIKeyGet MimeXML+-- | @text/xml@+instance Produces APIKeyGet MimeTextxml+-- | @application/javascript@+instance Produces APIKeyGet MimeJavascript+-- | @text/javascript@+instance Produces APIKeyGet MimeTextjavascript+++-- *** aPIKeyNew++-- | @POST \/apiKey@+-- +-- Create a new API Key.+-- +-- API Keys can also be created via [this Python script](https://github.com/BitMEX/market-maker/blob/master/generate-api-key.py) See the [API Key Documentation](/app/apiKeys) for more information on capabilities.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +aPIKeyNew + :: (Consumes APIKeyNew contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest APIKeyNew contentType APIKey accept+aPIKeyNew _ _ =+ _mkRequest "POST" ["/apiKey"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data APIKeyNew ++-- | /Optional Param/ "name" - Key name. This name is for reference only.+instance HasOptionalParam APIKeyNew Name where+ applyOptionalParam req (Name xs) =+ req `addForm` toForm ("name", xs)++-- | /Optional Param/ "cidr" - CIDR block to restrict this key to. To restrict to a single address, append \"/32\", e.g. 207.39.29.22/32. Leave blank or set to 0.0.0.0/0 to allow all IPs. Only one block may be set. <a href=\"http://software77.net/cidr-101.html\">More on CIDR blocks</a>+instance HasOptionalParam APIKeyNew Cidr where+ applyOptionalParam req (Cidr xs) =+ req `addForm` toForm ("cidr", xs)++-- | /Optional Param/ "permissions" - Key Permissions. All keys can read margin and position data. Additional permissions must be added. Available: [\"order\", \"orderCancel\", \"withdraw\"].+instance HasOptionalParam APIKeyNew Permissions where+ applyOptionalParam req (Permissions xs) =+ req `addForm` toForm ("permissions", xs)++-- | /Optional Param/ "enabled" - Set to true to enable this key on creation. Otherwise, it must be explicitly enabled via /apiKey/enable.+instance HasOptionalParam APIKeyNew Enabled where+ applyOptionalParam req (Enabled xs) =+ req `addForm` toForm ("enabled", xs)++-- | /Optional Param/ "token" - OTP Token (YubiKey, Google Authenticator)+instance HasOptionalParam APIKeyNew Token where+ applyOptionalParam req (Token xs) =+ req `addForm` toForm ("token", xs)++-- | @application/json@+instance Consumes APIKeyNew MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes APIKeyNew MimeFormUrlEncoded++-- | @application/json@+instance Produces APIKeyNew MimeJSON+-- | @application/xml@+instance Produces APIKeyNew MimeXML+-- | @text/xml@+instance Produces APIKeyNew MimeTextxml+-- | @application/javascript@+instance Produces APIKeyNew MimeJavascript+-- | @text/javascript@+instance Produces APIKeyNew MimeTextjavascript+++-- *** aPIKeyRemove++-- | @DELETE \/apiKey@+-- +-- Remove an API Key.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +aPIKeyRemove + :: (Consumes APIKeyRemove contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> ApiKeyId -- ^ "apiKeyId" - API Key ID (public component).+ -> BitMEXRequest APIKeyRemove contentType InlineResponse200 accept+aPIKeyRemove _ _ (ApiKeyId apiKeyId) =+ _mkRequest "DELETE" ["/apiKey"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("apiKeyID", apiKeyId)++data APIKeyRemove ++-- | @application/json@+instance Consumes APIKeyRemove MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes APIKeyRemove MimeFormUrlEncoded++-- | @application/json@+instance Produces APIKeyRemove MimeJSON+-- | @application/xml@+instance Produces APIKeyRemove MimeXML+-- | @text/xml@+instance Produces APIKeyRemove MimeTextxml+-- | @application/javascript@+instance Produces APIKeyRemove MimeJavascript+-- | @text/javascript@+instance Produces APIKeyRemove MimeTextjavascript+++-- ** Announcement++-- *** announcementGet++-- | @GET \/announcement@+-- +-- Get site announcements.+-- +announcementGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest AnnouncementGet MimeNoContent [Announcement] accept+announcementGet _ =+ _mkRequest "GET" ["/announcement"]++data AnnouncementGet ++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns.+instance HasOptionalParam AnnouncementGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | @application/json@+instance Consumes AnnouncementGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes AnnouncementGet MimeFormUrlEncoded++-- | @application/json@+instance Produces AnnouncementGet MimeJSON+-- | @application/xml@+instance Produces AnnouncementGet MimeXML+-- | @text/xml@+instance Produces AnnouncementGet MimeTextxml+-- | @application/javascript@+instance Produces AnnouncementGet MimeJavascript+-- | @text/javascript@+instance Produces AnnouncementGet MimeTextjavascript+++-- *** announcementGetUrgent++-- | @GET \/announcement\/urgent@+-- +-- Get urgent (banner) announcements.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +announcementGetUrgent + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest AnnouncementGetUrgent MimeNoContent [Announcement] accept+announcementGetUrgent _ =+ _mkRequest "GET" ["/announcement/urgent"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data AnnouncementGetUrgent ++-- | @application/json@+instance Consumes AnnouncementGetUrgent MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes AnnouncementGetUrgent MimeFormUrlEncoded++-- | @application/json@+instance Produces AnnouncementGetUrgent MimeJSON+-- | @application/xml@+instance Produces AnnouncementGetUrgent MimeXML+-- | @text/xml@+instance Produces AnnouncementGetUrgent MimeTextxml+-- | @application/javascript@+instance Produces AnnouncementGetUrgent MimeJavascript+-- | @text/javascript@+instance Produces AnnouncementGetUrgent MimeTextjavascript+++-- ** Chat++-- *** chatGet++-- | @GET \/chat@+-- +-- Get chat messages.+-- +chatGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest ChatGet MimeNoContent [Chat] accept+chatGet _ =+ _mkRequest "GET" ["/chat"]++data ChatGet ++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam ChatGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting ID for results.+instance HasOptionalParam ChatGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam ChatGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "channelID" - Channel id. GET /chat/channels for ids. Leave blank for all.+instance HasOptionalParam ChatGet ChannelId where+ applyOptionalParam req (ChannelId xs) =+ req `setQuery` toQuery ("channelID", Just xs)++-- | @application/json@+instance Consumes ChatGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes ChatGet MimeFormUrlEncoded++-- | @application/json@+instance Produces ChatGet MimeJSON+-- | @application/xml@+instance Produces ChatGet MimeXML+-- | @text/xml@+instance Produces ChatGet MimeTextxml+-- | @application/javascript@+instance Produces ChatGet MimeJavascript+-- | @text/javascript@+instance Produces ChatGet MimeTextjavascript+++-- *** chatGetChannels++-- | @GET \/chat\/channels@+-- +-- Get available channels.+-- +chatGetChannels + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest ChatGetChannels MimeNoContent [ChatChannels] accept+chatGetChannels _ =+ _mkRequest "GET" ["/chat/channels"]++data ChatGetChannels ++-- | @application/json@+instance Consumes ChatGetChannels MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes ChatGetChannels MimeFormUrlEncoded++-- | @application/json@+instance Produces ChatGetChannels MimeJSON+-- | @application/xml@+instance Produces ChatGetChannels MimeXML+-- | @text/xml@+instance Produces ChatGetChannels MimeTextxml+-- | @application/javascript@+instance Produces ChatGetChannels MimeJavascript+-- | @text/javascript@+instance Produces ChatGetChannels MimeTextjavascript+++-- *** chatGetConnected++-- | @GET \/chat\/connected@+-- +-- Get connected users.+-- +-- Returns an array with browser users in the first position and API users (bots) in the second position.+-- +chatGetConnected + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest ChatGetConnected MimeNoContent ConnectedUsers accept+chatGetConnected _ =+ _mkRequest "GET" ["/chat/connected"]++data ChatGetConnected ++-- | @application/json@+instance Consumes ChatGetConnected MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes ChatGetConnected MimeFormUrlEncoded++-- | @application/json@+instance Produces ChatGetConnected MimeJSON+-- | @application/xml@+instance Produces ChatGetConnected MimeXML+-- | @text/xml@+instance Produces ChatGetConnected MimeTextxml+-- | @application/javascript@+instance Produces ChatGetConnected MimeJavascript+-- | @text/javascript@+instance Produces ChatGetConnected MimeTextjavascript+++-- *** chatNew++-- | @POST \/chat@+-- +-- Send a chat message.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +chatNew + :: (Consumes ChatNew contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Message -- ^ "message"+ -> BitMEXRequest ChatNew contentType Chat accept+chatNew _ _ (Message message) =+ _mkRequest "POST" ["/chat"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("message", message)++data ChatNew ++-- | /Optional Param/ "channelID" - Channel to post to. Default 1 (English).+instance HasOptionalParam ChatNew ChannelId where+ applyOptionalParam req (ChannelId xs) =+ req `addForm` toForm ("channelID", xs)++-- | @application/json@+instance Consumes ChatNew MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes ChatNew MimeFormUrlEncoded++-- | @application/json@+instance Produces ChatNew MimeJSON+-- | @application/xml@+instance Produces ChatNew MimeXML+-- | @text/xml@+instance Produces ChatNew MimeTextxml+-- | @application/javascript@+instance Produces ChatNew MimeJavascript+-- | @text/javascript@+instance Produces ChatNew MimeTextjavascript+++-- ** Execution++-- *** executionGet++-- | @GET \/execution@+-- +-- Get all raw executions for your account.+-- +-- This returns all raw transactions, which includes order opening and cancelation, and order status changes. It can be quite noisy. More focused information is available at `/execution/tradeHistory`. You may also use the `filter` param to target your query. Specify an array as a filter value, such as `{\"execType\": [\"Settlement\", \"Trade\"]}` to filter on multiple values. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_8_8.html) for explanations of these fields. +-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +executionGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest ExecutionGet MimeNoContent [Execution] accept+executionGet _ =+ _mkRequest "GET" ["/execution"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data ExecutionGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam ExecutionGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam ExecutionGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam ExecutionGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam ExecutionGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam ExecutionGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam ExecutionGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam ExecutionGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam ExecutionGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes ExecutionGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes ExecutionGet MimeFormUrlEncoded++-- | @application/json@+instance Produces ExecutionGet MimeJSON+-- | @application/xml@+instance Produces ExecutionGet MimeXML+-- | @text/xml@+instance Produces ExecutionGet MimeTextxml+-- | @application/javascript@+instance Produces ExecutionGet MimeJavascript+-- | @text/javascript@+instance Produces ExecutionGet MimeTextjavascript+++-- *** executionGetTradeHistory++-- | @GET \/execution\/tradeHistory@+-- +-- Get all balance-affecting executions. This includes each trade, insurance charge, and settlement.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +executionGetTradeHistory + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest ExecutionGetTradeHistory MimeNoContent [Execution] accept+executionGetTradeHistory _ =+ _mkRequest "GET" ["/execution/tradeHistory"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data ExecutionGetTradeHistory ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam ExecutionGetTradeHistory Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam ExecutionGetTradeHistory Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam ExecutionGetTradeHistory Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam ExecutionGetTradeHistory Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam ExecutionGetTradeHistory Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam ExecutionGetTradeHistory Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam ExecutionGetTradeHistory StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam ExecutionGetTradeHistory EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes ExecutionGetTradeHistory MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes ExecutionGetTradeHistory MimeFormUrlEncoded++-- | @application/json@+instance Produces ExecutionGetTradeHistory MimeJSON+-- | @application/xml@+instance Produces ExecutionGetTradeHistory MimeXML+-- | @text/xml@+instance Produces ExecutionGetTradeHistory MimeTextxml+-- | @application/javascript@+instance Produces ExecutionGetTradeHistory MimeJavascript+-- | @text/javascript@+instance Produces ExecutionGetTradeHistory MimeTextjavascript+++-- ** Funding++-- *** fundingGet++-- | @GET \/funding@+-- +-- Get funding history.+-- +fundingGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest FundingGet MimeNoContent [Funding] accept+fundingGet _ =+ _mkRequest "GET" ["/funding"]++data FundingGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam FundingGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam FundingGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam FundingGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam FundingGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam FundingGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam FundingGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam FundingGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam FundingGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes FundingGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes FundingGet MimeFormUrlEncoded++-- | @application/json@+instance Produces FundingGet MimeJSON+-- | @application/xml@+instance Produces FundingGet MimeXML+-- | @text/xml@+instance Produces FundingGet MimeTextxml+-- | @application/javascript@+instance Produces FundingGet MimeJavascript+-- | @text/javascript@+instance Produces FundingGet MimeTextjavascript+++-- ** Instrument++-- *** instrumentGet++-- | @GET \/instrument@+-- +-- Get instruments.+-- +-- This returns all instruments and indices, including those that have settled or are unlisted. Use this endpoint if you want to query for individual instruments or use a complex filter. Use `/instrument/active` to return active instruments, or use a filter like `{\"state\": \"Open\"}`.+-- +instrumentGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InstrumentGet MimeNoContent [Instrument] accept+instrumentGet _ =+ _mkRequest "GET" ["/instrument"]++data InstrumentGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam InstrumentGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam InstrumentGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam InstrumentGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam InstrumentGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam InstrumentGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam InstrumentGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam InstrumentGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam InstrumentGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes InstrumentGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InstrumentGet MimeFormUrlEncoded++-- | @application/json@+instance Produces InstrumentGet MimeJSON+-- | @application/xml@+instance Produces InstrumentGet MimeXML+-- | @text/xml@+instance Produces InstrumentGet MimeTextxml+-- | @application/javascript@+instance Produces InstrumentGet MimeJavascript+-- | @text/javascript@+instance Produces InstrumentGet MimeTextjavascript+++-- *** instrumentGetActive++-- | @GET \/instrument\/active@+-- +-- Get all active instruments and instruments that have expired in <24hrs.+-- +instrumentGetActive + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InstrumentGetActive MimeNoContent [Instrument] accept+instrumentGetActive _ =+ _mkRequest "GET" ["/instrument/active"]++data InstrumentGetActive ++-- | @application/json@+instance Consumes InstrumentGetActive MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InstrumentGetActive MimeFormUrlEncoded++-- | @application/json@+instance Produces InstrumentGetActive MimeJSON+-- | @application/xml@+instance Produces InstrumentGetActive MimeXML+-- | @text/xml@+instance Produces InstrumentGetActive MimeTextxml+-- | @application/javascript@+instance Produces InstrumentGetActive MimeJavascript+-- | @text/javascript@+instance Produces InstrumentGetActive MimeTextjavascript+++-- *** instrumentGetActiveAndIndices++-- | @GET \/instrument\/activeAndIndices@+-- +-- Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.+-- +instrumentGetActiveAndIndices + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InstrumentGetActiveAndIndices MimeNoContent [Instrument] accept+instrumentGetActiveAndIndices _ =+ _mkRequest "GET" ["/instrument/activeAndIndices"]++data InstrumentGetActiveAndIndices ++-- | @application/json@+instance Consumes InstrumentGetActiveAndIndices MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InstrumentGetActiveAndIndices MimeFormUrlEncoded++-- | @application/json@+instance Produces InstrumentGetActiveAndIndices MimeJSON+-- | @application/xml@+instance Produces InstrumentGetActiveAndIndices MimeXML+-- | @text/xml@+instance Produces InstrumentGetActiveAndIndices MimeTextxml+-- | @application/javascript@+instance Produces InstrumentGetActiveAndIndices MimeJavascript+-- | @text/javascript@+instance Produces InstrumentGetActiveAndIndices MimeTextjavascript+++-- *** instrumentGetActiveIntervals++-- | @GET \/instrument\/activeIntervals@+-- +-- Return all active contract series and interval pairs.+-- +-- This endpoint is useful for determining which pairs are live. It returns two arrays of strings. The first is intervals, such as `[\"BVOL:daily\", \"BVOL:weekly\", \"XBU:daily\", \"XBU:monthly\", ...]`. These identifiers are usable in any query's `symbol` param. The second array is the current resolution of these intervals. Results are mapped at the same index.+-- +instrumentGetActiveIntervals + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InstrumentGetActiveIntervals MimeNoContent InstrumentInterval accept+instrumentGetActiveIntervals _ =+ _mkRequest "GET" ["/instrument/activeIntervals"]++data InstrumentGetActiveIntervals ++-- | @application/json@+instance Consumes InstrumentGetActiveIntervals MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InstrumentGetActiveIntervals MimeFormUrlEncoded++-- | @application/json@+instance Produces InstrumentGetActiveIntervals MimeJSON+-- | @application/xml@+instance Produces InstrumentGetActiveIntervals MimeXML+-- | @text/xml@+instance Produces InstrumentGetActiveIntervals MimeTextxml+-- | @application/javascript@+instance Produces InstrumentGetActiveIntervals MimeJavascript+-- | @text/javascript@+instance Produces InstrumentGetActiveIntervals MimeTextjavascript+++-- *** instrumentGetCompositeIndex++-- | @GET \/instrument\/compositeIndex@+-- +-- Show constituent parts of an index.+-- +-- Composite indices are built from multiple external price sources. Use this endpoint to get the underlying prices of an index. For example, send a `symbol` of `.XBT` to get the ticks and weights of the constituent exchanges that build the \".XBT\" index. A tick with reference `\"BMI\"` and weight `null` is the composite index tick. +-- +instrumentGetCompositeIndex + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InstrumentGetCompositeIndex MimeNoContent [IndexComposite] accept+instrumentGetCompositeIndex _ =+ _mkRequest "GET" ["/instrument/compositeIndex"]++data InstrumentGetCompositeIndex +instance HasOptionalParam InstrumentGetCompositeIndex Account where+ applyOptionalParam req (Account xs) =+ req `setQuery` toQuery ("account", Just xs)++-- | /Optional Param/ "symbol" - The composite index symbol.+instance HasOptionalParam InstrumentGetCompositeIndex Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam InstrumentGetCompositeIndex Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam InstrumentGetCompositeIndex Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam InstrumentGetCompositeIndex Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam InstrumentGetCompositeIndex Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam InstrumentGetCompositeIndex Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam InstrumentGetCompositeIndex StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam InstrumentGetCompositeIndex EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes InstrumentGetCompositeIndex MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InstrumentGetCompositeIndex MimeFormUrlEncoded++-- | @application/json@+instance Produces InstrumentGetCompositeIndex MimeJSON+-- | @application/xml@+instance Produces InstrumentGetCompositeIndex MimeXML+-- | @text/xml@+instance Produces InstrumentGetCompositeIndex MimeTextxml+-- | @application/javascript@+instance Produces InstrumentGetCompositeIndex MimeJavascript+-- | @text/javascript@+instance Produces InstrumentGetCompositeIndex MimeTextjavascript+++-- *** instrumentGetIndices++-- | @GET \/instrument\/indices@+-- +-- Get all price indices.+-- +instrumentGetIndices + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InstrumentGetIndices MimeNoContent [Instrument] accept+instrumentGetIndices _ =+ _mkRequest "GET" ["/instrument/indices"]++data InstrumentGetIndices ++-- | @application/json@+instance Consumes InstrumentGetIndices MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InstrumentGetIndices MimeFormUrlEncoded++-- | @application/json@+instance Produces InstrumentGetIndices MimeJSON+-- | @application/xml@+instance Produces InstrumentGetIndices MimeXML+-- | @text/xml@+instance Produces InstrumentGetIndices MimeTextxml+-- | @application/javascript@+instance Produces InstrumentGetIndices MimeJavascript+-- | @text/javascript@+instance Produces InstrumentGetIndices MimeTextjavascript+++-- ** Insurance++-- *** insuranceGet++-- | @GET \/insurance@+-- +-- Get insurance fund history.+-- +insuranceGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest InsuranceGet MimeNoContent [Insurance] accept+insuranceGet _ =+ _mkRequest "GET" ["/insurance"]++data InsuranceGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam InsuranceGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam InsuranceGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam InsuranceGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam InsuranceGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam InsuranceGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam InsuranceGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam InsuranceGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam InsuranceGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes InsuranceGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes InsuranceGet MimeFormUrlEncoded++-- | @application/json@+instance Produces InsuranceGet MimeJSON+-- | @application/xml@+instance Produces InsuranceGet MimeXML+-- | @text/xml@+instance Produces InsuranceGet MimeTextxml+-- | @application/javascript@+instance Produces InsuranceGet MimeJavascript+-- | @text/javascript@+instance Produces InsuranceGet MimeTextjavascript+++-- ** Leaderboard++-- *** leaderboardGet++-- | @GET \/leaderboard@+-- +-- Get current leaderboard.+-- +leaderboardGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest LeaderboardGet MimeNoContent [Leaderboard] accept+leaderboardGet _ =+ _mkRequest "GET" ["/leaderboard"]++data LeaderboardGet ++-- | /Optional Param/ "method" - Ranking type. Options: \"notional\", \"ROE\"+instance HasOptionalParam LeaderboardGet Method where+ applyOptionalParam req (Method xs) =+ req `setQuery` toQuery ("method", Just xs)++-- | @application/json@+instance Consumes LeaderboardGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes LeaderboardGet MimeFormUrlEncoded++-- | @application/json@+instance Produces LeaderboardGet MimeJSON+-- | @application/xml@+instance Produces LeaderboardGet MimeXML+-- | @text/xml@+instance Produces LeaderboardGet MimeTextxml+-- | @application/javascript@+instance Produces LeaderboardGet MimeJavascript+-- | @text/javascript@+instance Produces LeaderboardGet MimeTextjavascript+++-- ** Liquidation++-- *** liquidationGet++-- | @GET \/liquidation@+-- +-- Get liquidation orders.+-- +liquidationGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest LiquidationGet MimeNoContent [Liquidation] accept+liquidationGet _ =+ _mkRequest "GET" ["/liquidation"]++data LiquidationGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam LiquidationGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam LiquidationGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam LiquidationGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam LiquidationGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam LiquidationGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam LiquidationGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam LiquidationGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam LiquidationGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes LiquidationGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes LiquidationGet MimeFormUrlEncoded++-- | @application/json@+instance Produces LiquidationGet MimeJSON+-- | @application/xml@+instance Produces LiquidationGet MimeXML+-- | @text/xml@+instance Produces LiquidationGet MimeTextxml+-- | @application/javascript@+instance Produces LiquidationGet MimeJavascript+-- | @text/javascript@+instance Produces LiquidationGet MimeTextjavascript+++-- ** Notification++-- *** notificationGet++-- | @GET \/notification@+-- +-- Get your current notifications.+-- +-- This is an upcoming feature and currently does not return data.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +notificationGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest NotificationGet MimeNoContent [Notification] accept+notificationGet _ =+ _mkRequest "GET" ["/notification"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data NotificationGet ++-- | @application/json@+instance Consumes NotificationGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes NotificationGet MimeFormUrlEncoded++-- | @application/json@+instance Produces NotificationGet MimeJSON+-- | @application/xml@+instance Produces NotificationGet MimeXML+-- | @text/xml@+instance Produces NotificationGet MimeTextxml+-- | @application/javascript@+instance Produces NotificationGet MimeJavascript+-- | @text/javascript@+instance Produces NotificationGet MimeTextjavascript+++-- ** Order++-- *** orderAmend++-- | @PUT \/order@+-- +-- Amend the quantity or price of an open order.+-- +-- Send an `orderID` or `origClOrdID` to identify the order you wish to amend. Both order quantity and price can be amended. Only one `qty` field can be used to amend. Use the `leavesQty` field to specify how much of the order you wish to remain open. This can be useful if you want to adjust your position's delta by a certain amount, regardless of how much of the order has already filled. Use the `simpleOrderQty` and `simpleLeavesQty` fields to specify order size in Bitcoin, rather than contracts. These fields will round up to the nearest contract. Like order placement, amending can be done in bulk. Simply send a request to `PUT /api/v1/order/bulk` with a JSON body of the shape: `{\"orders\": [{...}, {...}]}`, each object containing the fields used in this endpoint. +-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderAmend + :: (Consumes OrderAmend contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest OrderAmend contentType Order accept+orderAmend _ _ =+ _mkRequest "PUT" ["/order"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data OrderAmend ++-- | /Optional Param/ "orderID" - Order ID+instance HasOptionalParam OrderAmend OrderId where+ applyOptionalParam req (OrderId xs) =+ req `addForm` toForm ("orderID", xs)++-- | /Optional Param/ "origClOrdID" - Client Order ID. See POST /order.+instance HasOptionalParam OrderAmend OrigClOrdId where+ applyOptionalParam req (OrigClOrdId xs) =+ req `addForm` toForm ("origClOrdID", xs)++-- | /Optional Param/ "clOrdID" - Optional new Client Order ID, requires `origClOrdID`.+instance HasOptionalParam OrderAmend ClOrdId where+ applyOptionalParam req (ClOrdId xs) =+ req `addForm` toForm ("clOrdID", xs)++-- | /Optional Param/ "simpleOrderQty" - Optional order quantity in units of the underlying instrument (i.e. Bitcoin).+instance HasOptionalParam OrderAmend SimpleOrderQty where+ applyOptionalParam req (SimpleOrderQty xs) =+ req `addForm` toForm ("simpleOrderQty", xs)++-- | /Optional Param/ "orderQty" - Optional order quantity in units of the instrument (i.e. contracts).+instance HasOptionalParam OrderAmend OrderQty where+ applyOptionalParam req (OrderQty xs) =+ req `addForm` toForm ("orderQty", xs)++-- | /Optional Param/ "simpleLeavesQty" - Optional leaves quantity in units of the underlying instrument (i.e. Bitcoin). Useful for amending partially filled orders.+instance HasOptionalParam OrderAmend SimpleLeavesQty where+ applyOptionalParam req (SimpleLeavesQty xs) =+ req `addForm` toForm ("simpleLeavesQty", xs)++-- | /Optional Param/ "leavesQty" - Optional leaves quantity in units of the instrument (i.e. contracts). Useful for amending partially filled orders.+instance HasOptionalParam OrderAmend LeavesQty where+ applyOptionalParam req (LeavesQty xs) =+ req `addForm` toForm ("leavesQty", xs)++-- | /Optional Param/ "price" - Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.+instance HasOptionalParam OrderAmend Price where+ applyOptionalParam req (Price xs) =+ req `addForm` toForm ("price", xs)++-- | /Optional Param/ "stopPx" - Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders.+instance HasOptionalParam OrderAmend StopPx where+ applyOptionalParam req (StopPx xs) =+ req `addForm` toForm ("stopPx", xs)++-- | /Optional Param/ "pegOffsetValue" - Optional trailing offset from the current price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.+instance HasOptionalParam OrderAmend PegOffsetValue where+ applyOptionalParam req (PegOffsetValue xs) =+ req `addForm` toForm ("pegOffsetValue", xs)++-- | /Optional Param/ "text" - Optional amend annotation. e.g. 'Adjust skew'.+instance HasOptionalParam OrderAmend ParamText where+ applyOptionalParam req (ParamText xs) =+ req `addForm` toForm ("text", xs)++-- | @application/json@+instance Consumes OrderAmend MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderAmend MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderAmend MimeJSON+-- | @application/xml@+instance Produces OrderAmend MimeXML+-- | @text/xml@+instance Produces OrderAmend MimeTextxml+-- | @application/javascript@+instance Produces OrderAmend MimeJavascript+-- | @text/javascript@+instance Produces OrderAmend MimeTextjavascript+++-- *** orderAmendBulk++-- | @PUT \/order\/bulk@+-- +-- Amend multiple orders for the same symbol.+-- +-- Similar to POST /amend, but with multiple orders. `application/json` only. Ratelimited at 50%.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderAmendBulk + :: (Consumes OrderAmendBulk contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest OrderAmendBulk contentType [Order] accept+orderAmendBulk _ _ =+ _mkRequest "PUT" ["/order/bulk"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data OrderAmendBulk ++-- | /Optional Param/ "orders" - An array of orders.+instance HasOptionalParam OrderAmendBulk Orders where+ applyOptionalParam req (Orders xs) =+ req `addForm` toForm ("orders", xs)++-- | @application/json@+instance Consumes OrderAmendBulk MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderAmendBulk MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderAmendBulk MimeJSON+-- | @application/xml@+instance Produces OrderAmendBulk MimeXML+-- | @text/xml@+instance Produces OrderAmendBulk MimeTextxml+-- | @application/javascript@+instance Produces OrderAmendBulk MimeJavascript+-- | @text/javascript@+instance Produces OrderAmendBulk MimeTextjavascript+++-- *** orderCancel++-- | @DELETE \/order@+-- +-- Cancel order(s). Send multiple order IDs to cancel in bulk.+-- +-- Either an orderID or a clOrdID must be provided.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderCancel + :: (Consumes OrderCancel contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest OrderCancel contentType [Order] accept+orderCancel _ _ =+ _mkRequest "DELETE" ["/order"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data OrderCancel ++-- | /Optional Param/ "orderID" - Order ID(s).+instance HasOptionalParam OrderCancel OrderId where+ applyOptionalParam req (OrderId xs) =+ req `addForm` toForm ("orderID", xs)++-- | /Optional Param/ "clOrdID" - Client Order ID(s). See POST /order.+instance HasOptionalParam OrderCancel ClOrdId where+ applyOptionalParam req (ClOrdId xs) =+ req `addForm` toForm ("clOrdID", xs)++-- | /Optional Param/ "text" - Optional cancellation annotation. e.g. 'Spread Exceeded'.+instance HasOptionalParam OrderCancel ParamText where+ applyOptionalParam req (ParamText xs) =+ req `addForm` toForm ("text", xs)++-- | @application/json@+instance Consumes OrderCancel MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderCancel MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderCancel MimeJSON+-- | @application/xml@+instance Produces OrderCancel MimeXML+-- | @text/xml@+instance Produces OrderCancel MimeTextxml+-- | @application/javascript@+instance Produces OrderCancel MimeJavascript+-- | @text/javascript@+instance Produces OrderCancel MimeTextjavascript+++-- *** orderCancelAll++-- | @DELETE \/order\/all@+-- +-- Cancels all of your orders.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderCancelAll + :: (Consumes OrderCancelAll contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest OrderCancelAll contentType A.Value accept+orderCancelAll _ _ =+ _mkRequest "DELETE" ["/order/all"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data OrderCancelAll ++-- | /Optional Param/ "symbol" - Optional symbol. If provided, only cancels orders for that symbol.+instance HasOptionalParam OrderCancelAll Symbol where+ applyOptionalParam req (Symbol xs) =+ req `addForm` toForm ("symbol", xs)++-- | /Optional Param/ "filter" - Optional filter for cancellation. Use to only cancel some orders, e.g. `{\"side\": \"Buy\"}`.+instance HasOptionalParam OrderCancelAll Filter where+ applyOptionalParam req (Filter xs) =+ req `addForm` toForm ("filter", xs)++-- | /Optional Param/ "text" - Optional cancellation annotation. e.g. 'Spread Exceeded'+instance HasOptionalParam OrderCancelAll ParamText where+ applyOptionalParam req (ParamText xs) =+ req `addForm` toForm ("text", xs)++-- | @application/json@+instance Consumes OrderCancelAll MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderCancelAll MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderCancelAll MimeJSON+-- | @application/xml@+instance Produces OrderCancelAll MimeXML+-- | @text/xml@+instance Produces OrderCancelAll MimeTextxml+-- | @application/javascript@+instance Produces OrderCancelAll MimeJavascript+-- | @text/javascript@+instance Produces OrderCancelAll MimeTextjavascript+++-- *** orderCancelAllAfter++-- | @POST \/order\/cancelAllAfter@+-- +-- Automatically cancel all your orders after a specified timeout.+-- +-- Useful as a dead-man's switch to ensure your orders are canceled in case of an outage. If called repeatedly, the existing offset will be canceled and a new one will be inserted in its place. Example usage: call this route at 15s intervals with an offset of 60000 (60s). If this route is not called within 60 seconds, all your orders will be automatically canceled. This is also available via [WebSocket](https://www.bitmex.com/app/wsAPI#dead-man-s-switch-auto-cancel-). +-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderCancelAllAfter + :: (Consumes OrderCancelAllAfter contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Timeout -- ^ "timeout" - Timeout in ms. Set to 0 to cancel this timer. + -> BitMEXRequest OrderCancelAllAfter contentType A.Value accept+orderCancelAllAfter _ _ (Timeout timeout) =+ _mkRequest "POST" ["/order/cancelAllAfter"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("timeout", timeout)++data OrderCancelAllAfter ++-- | @application/json@+instance Consumes OrderCancelAllAfter MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderCancelAllAfter MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderCancelAllAfter MimeJSON+-- | @application/xml@+instance Produces OrderCancelAllAfter MimeXML+-- | @text/xml@+instance Produces OrderCancelAllAfter MimeTextxml+-- | @application/javascript@+instance Produces OrderCancelAllAfter MimeJavascript+-- | @text/javascript@+instance Produces OrderCancelAllAfter MimeTextjavascript+++-- *** orderClosePosition++-- | @POST \/order\/closePosition@+-- +-- Close a position. [Deprecated, use POST /order with execInst: 'Close']+-- +-- If no `price` is specified, a market order will be submitted to close the whole of your position. This will also close all other open orders in this symbol.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderClosePosition + :: (Consumes OrderClosePosition contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Symbol of position to close.+ -> BitMEXRequest OrderClosePosition contentType Order accept+orderClosePosition _ _ (Symbol symbol) =+ _mkRequest "POST" ["/order/closePosition"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("symbol", symbol)++data OrderClosePosition ++-- | /Optional Param/ "price" - Optional limit price.+instance HasOptionalParam OrderClosePosition Price where+ applyOptionalParam req (Price xs) =+ req `addForm` toForm ("price", xs)++-- | @application/json@+instance Consumes OrderClosePosition MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderClosePosition MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderClosePosition MimeJSON+-- | @application/xml@+instance Produces OrderClosePosition MimeXML+-- | @text/xml@+instance Produces OrderClosePosition MimeTextxml+-- | @application/javascript@+instance Produces OrderClosePosition MimeJavascript+-- | @text/javascript@+instance Produces OrderClosePosition MimeTextjavascript+++-- *** orderGetOrders++-- | @GET \/order@+-- +-- Get your orders.+-- +-- To get open orders only, send {\"open\": true} in the filter param. See <a href=\"http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_D_68.html\">the FIX Spec</a> for explanations of these fields.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderGetOrders + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest OrderGetOrders MimeNoContent [Order] accept+orderGetOrders _ =+ _mkRequest "GET" ["/order"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data OrderGetOrders ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam OrderGetOrders Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam OrderGetOrders Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam OrderGetOrders Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam OrderGetOrders Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam OrderGetOrders Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam OrderGetOrders Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam OrderGetOrders StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam OrderGetOrders EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes OrderGetOrders MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderGetOrders MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderGetOrders MimeJSON+-- | @application/xml@+instance Produces OrderGetOrders MimeXML+-- | @text/xml@+instance Produces OrderGetOrders MimeTextxml+-- | @application/javascript@+instance Produces OrderGetOrders MimeJavascript+-- | @text/javascript@+instance Produces OrderGetOrders MimeTextjavascript+++-- *** orderNew++-- | @POST \/order@+-- +-- Create a new order.+-- +-- ## Placing Orders This endpoint is used for placing orders. See individual fields below for more details on their use. #### Order Types All orders require a `symbol`. All other fields are optional except when otherwise specified. These are the valid `ordType`s: * **Limit**: The default order type. Specify an `orderQty` and `price`. * **Market**: A traditional Market order. A Market order will execute until filled or your bankruptcy price is reached, at which point it will cancel. * **MarketWithLeftOverAsLimit**: A market order that, after eating through the order book as far as permitted by available margin, will become a limit order. The difference between this type and `Market` only affects the behavior in thin books. Upon reaching the deepest possible price, if there is quantity left over, a `Market` order will cancel the remaining quantity. `MarketWithLeftOverAsLimit` will keep the remaining quantity in the books as a `Limit`. * **Stop**: A Stop Market order. Specify an `orderQty` and `stopPx`. When the `stopPx` is reached, the order will be entered into the book. * On sell orders, the order will trigger if the triggering price is lower than the `stopPx`. On buys, higher. * Note: Stop orders do not consume margin until triggered. Be sure that the required margin is available in your account so that it may trigger fully. * `Close` Stops don't require an `orderQty`. See Execution Instructions below. * **StopLimit**: Like a Stop Market, but enters a Limit order instead of a Market order. Specify an `orderQty`, `stopPx`, and `price`. * **MarketIfTouched**: Similar to a Stop, but triggers are done in the opposite direction. Useful for Take Profit orders. * **LimitIfTouched**: As above; use for Take Profit Limit orders. #### Execution Instructions The following `execInst`s are supported. If using multiple, separate with a comma (e.g. `LastPrice,Close`). * **ParticipateDoNotInitiate**: Also known as a Post-Only order. If this order would have executed on placement, it will cancel instead. * **AllOrNone**: Valid only for hidden orders (`displayQty: 0`). Use to only execute if the entire order would fill. * **MarkPrice, LastPrice, IndexPrice**: Used by stop and if-touched orders to determine the triggering price. Use only one. By default, `'MarkPrice'` is used. Also used for Pegged orders to define the value of `'LastPeg'`. * **ReduceOnly**: A `'ReduceOnly'` order can only reduce your position, not increase it. If you have a `'ReduceOnly'` limit order that rests in the order book while the position is reduced by other orders, then its order quantity will be amended down or canceled. If there are multiple `'ReduceOnly'` orders the least agresssive will be amended first. * **Close**: `'Close'` implies `'ReduceOnly'`. A `'Close'` order will cancel other active limit orders with the same side and symbol if the open quantity exceeds the current position. This is useful for stops: by canceling these orders, a `'Close'` Stop is ensured to have the margin required to execute, and can only execute up to the full size of your position. If not specified, a `'Close'` order has an `orderQty` equal to your current position's size. #### Linked Orders Linked Orders are an advanced capability. It is very powerful, but its use requires careful coding and testing. Please follow this document carefully and use the [Testnet Exchange](https://testnet.bitmex.com) while developing. BitMEX offers four advanced Linked Order types: * **OCO**: *One Cancels the Other*. A very flexible version of the standard Stop / Take Profit technique. Multiple orders may be linked together using a single `clOrdLinkID`. Send a `contingencyType` of `OneCancelsTheOther` on the orders. The first order that fully or partially executes (or activates for `Stop` orders) will cancel all other orders with the same `clOrdLinkID`. * **OTO**: *One Triggers the Other*. Send a `contingencyType` of `'OneTriggersTheOther'` on the primary order and then subsequent orders with the same `clOrdLinkID` will be not be triggered until the primary order fully executes. * **OUOA**: *One Updates the Other Absolute*. Send a `contingencyType` of `'OneUpdatesTheOtherAbsolute'` on the orders. Then as one order has a execution, other orders with the same `clOrdLinkID` will have their order quantity amended down by the execution quantity. * **OUOP**: *One Updates the Other Proportional*. Send a `contingencyType` of `'OneUpdatesTheOtherProportional'` on the orders. Then as one order has a execution, other orders with the same `clOrdLinkID` will have their order quantity reduced proportionally by the fill percentage. #### Trailing Stops You may use `pegPriceType` of `'TrailingStopPeg'` to create Trailing Stops. The pegged `stopPx` will move as the market moves away from the peg, and freeze as the market moves toward it. To use, combine with `pegOffsetValue` to set the `stopPx` of your order. The peg is set to the triggering price specified in the `execInst` (default `'MarkPrice'`). Use a negative offset for stop-sell and buy-if-touched orders. Requires `ordType`: `'Stop', 'StopLimit', 'MarketIfTouched', 'LimitIfTouched'`. #### Simple Quantities Send a `simpleOrderQty` instead of an `orderQty` to create an order denominated in the underlying currency. This is useful for opening up a position with 1 XBT of exposure without having to calculate how many contracts it is. #### Rate Limits See the [Bulk Order Documentation](#!/Order/Order_newBulk) if you need to place multiple orders at the same time. Bulk orders require fewer risk checks in the trading engine and thus are ratelimited at **1/10** the normal rate. You can also improve your reactivity to market movements while staying under your ratelimit by using the [Amend](#!/Order/Order_amend) and [Amend Bulk](#!/Order/Order_amendBulk) endpoints. This allows you to stay in the market and avoids the cancel/replace cycle. #### Tracking Your Orders If you want to keep track of order IDs yourself, set a unique `clOrdID` per order. This `clOrdID` will come back as a property on the order and any related executions (including on the WebSocket), and can be used to get or cancel the order. Max length is 36 characters. +-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderNew + :: (Consumes OrderNew contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Instrument symbol. e.g. 'XBTUSD'.+ -> BitMEXRequest OrderNew contentType Order accept+orderNew _ _ (Symbol symbol) =+ _mkRequest "POST" ["/order"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("symbol", symbol)++data OrderNew ++-- | /Optional Param/ "side" - Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless `orderQty` or `simpleOrderQty` is negative.+instance HasOptionalParam OrderNew Side where+ applyOptionalParam req (Side xs) =+ req `addForm` toForm ("side", xs)++-- | /Optional Param/ "simpleOrderQty" - Order quantity in units of the underlying instrument (i.e. Bitcoin).+instance HasOptionalParam OrderNew SimpleOrderQty where+ applyOptionalParam req (SimpleOrderQty xs) =+ req `addForm` toForm ("simpleOrderQty", xs)++-- | /Optional Param/ "quantity" - Deprecated: use `orderQty`.+instance HasOptionalParam OrderNew Quantity where+ applyOptionalParam req (Quantity xs) =+ req `addForm` toForm ("quantity", xs)++-- | /Optional Param/ "orderQty" - Order quantity in units of the instrument (i.e. contracts).+instance HasOptionalParam OrderNew OrderQty where+ applyOptionalParam req (OrderQty xs) =+ req `addForm` toForm ("orderQty", xs)++-- | /Optional Param/ "price" - Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.+instance HasOptionalParam OrderNew Price where+ applyOptionalParam req (Price xs) =+ req `addForm` toForm ("price", xs)++-- | /Optional Param/ "displayQty" - Optional quantity to display in the book. Use 0 for a fully hidden order.+instance HasOptionalParam OrderNew DisplayQty where+ applyOptionalParam req (DisplayQty xs) =+ req `addForm` toForm ("displayQty", xs)++-- | /Optional Param/ "stopPrice" - Deprecated: use `stopPx`.+instance HasOptionalParam OrderNew StopPrice where+ applyOptionalParam req (StopPrice xs) =+ req `addForm` toForm ("stopPrice", xs)++-- | /Optional Param/ "stopPx" - Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders. Use `execInst` of 'MarkPrice' or 'LastPrice' to define the current price used for triggering.+instance HasOptionalParam OrderNew StopPx where+ applyOptionalParam req (StopPx xs) =+ req `addForm` toForm ("stopPx", xs)++-- | /Optional Param/ "clOrdID" - Optional Client Order ID. This clOrdID will come back on the order and any related executions.+instance HasOptionalParam OrderNew ClOrdId where+ applyOptionalParam req (ClOrdId xs) =+ req `addForm` toForm ("clOrdID", xs)++-- | /Optional Param/ "clOrdLinkID" - Optional Client Order Link ID for contingent orders.+instance HasOptionalParam OrderNew ClOrdLinkId where+ applyOptionalParam req (ClOrdLinkId xs) =+ req `addForm` toForm ("clOrdLinkID", xs)++-- | /Optional Param/ "pegOffsetValue" - Optional trailing offset from the current price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.+instance HasOptionalParam OrderNew PegOffsetValue where+ applyOptionalParam req (PegOffsetValue xs) =+ req `addForm` toForm ("pegOffsetValue", xs)++-- | /Optional Param/ "pegPriceType" - Optional peg price type. Valid options: LastPeg, MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg.+instance HasOptionalParam OrderNew PegPriceType where+ applyOptionalParam req (PegPriceType xs) =+ req `addForm` toForm ("pegPriceType", xs)++-- | /Optional Param/ "type" - Deprecated: use `ordType`.+instance HasOptionalParam OrderNew ParamType where+ applyOptionalParam req (ParamType xs) =+ req `addForm` toForm ("type", xs)++-- | /Optional Param/ "ordType" - Order type. Valid options: Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit, Pegged. Defaults to 'Limit' when `price` is specified. Defaults to 'Stop' when `stopPx` is specified. Defaults to 'StopLimit' when `price` and `stopPx` are specified.+instance HasOptionalParam OrderNew OrdType where+ applyOptionalParam req (OrdType xs) =+ req `addForm` toForm ("ordType", xs)++-- | /Optional Param/ "timeInForce" - Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel, FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', 'LimitIfTouched', and 'MarketWithLeftOverAsLimit' orders.+instance HasOptionalParam OrderNew TimeInForce where+ applyOptionalParam req (TimeInForce xs) =+ req `addForm` toForm ("timeInForce", xs)++-- | /Optional Param/ "execInst" - Optional execution instructions. Valid options: ParticipateDoNotInitiate, AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed. 'AllOrNone' instruction requires `displayQty` to be 0. 'MarkPrice', 'IndexPrice' or 'LastPrice' instruction valid for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders.+instance HasOptionalParam OrderNew ExecInst where+ applyOptionalParam req (ExecInst xs) =+ req `addForm` toForm ("execInst", xs)++-- | /Optional Param/ "contingencyType" - Optional contingency type for use with `clOrdLinkID`. Valid options: OneCancelsTheOther, OneTriggersTheOther, OneUpdatesTheOtherAbsolute, OneUpdatesTheOtherProportional.+instance HasOptionalParam OrderNew ContingencyType where+ applyOptionalParam req (ContingencyType xs) =+ req `addForm` toForm ("contingencyType", xs)++-- | /Optional Param/ "text" - Optional order annotation. e.g. 'Take profit'.+instance HasOptionalParam OrderNew ParamText where+ applyOptionalParam req (ParamText xs) =+ req `addForm` toForm ("text", xs)++-- | @application/json@+instance Consumes OrderNew MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderNew MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderNew MimeJSON+-- | @application/xml@+instance Produces OrderNew MimeXML+-- | @text/xml@+instance Produces OrderNew MimeTextxml+-- | @application/javascript@+instance Produces OrderNew MimeJavascript+-- | @text/javascript@+instance Produces OrderNew MimeTextjavascript+++-- *** orderNewBulk++-- | @POST \/order\/bulk@+-- +-- Create multiple new orders for the same symbol.+-- +-- This endpoint is used for placing bulk orders. Valid order types are Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit, and Pegged. Each individual order object in the array should have the same properties as an individual POST /order call. This endpoint is much faster for getting many orders into the book at once. Because it reduces load on BitMEX systems, this endpoint is ratelimited at `ceil(0.1 * orders)`. Submitting 10 orders via a bulk order call will only count as 1 request, 15 as 2, 32 as 4, and so on. For now, only `application/json` is supported on this endpoint. +-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +orderNewBulk + :: (Consumes OrderNewBulk contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest OrderNewBulk contentType [Order] accept+orderNewBulk _ _ =+ _mkRequest "POST" ["/order/bulk"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data OrderNewBulk ++-- | /Optional Param/ "orders" - An array of orders.+instance HasOptionalParam OrderNewBulk Orders where+ applyOptionalParam req (Orders xs) =+ req `addForm` toForm ("orders", xs)++-- | @application/json@+instance Consumes OrderNewBulk MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderNewBulk MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderNewBulk MimeJSON+-- | @application/xml@+instance Produces OrderNewBulk MimeXML+-- | @text/xml@+instance Produces OrderNewBulk MimeTextxml+-- | @application/javascript@+instance Produces OrderNewBulk MimeJavascript+-- | @text/javascript@+instance Produces OrderNewBulk MimeTextjavascript+++-- ** OrderBook++-- *** orderBookGet++-- | @GET \/orderBook@+-- +-- Get current orderbook [deprecated, use /orderBook/L2].+-- +orderBookGet + :: Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series.+ -> BitMEXRequest OrderBookGet MimeNoContent [OrderBook] accept+orderBookGet _ (Symbol symbol) =+ _mkRequest "GET" ["/orderBook"]+ `setQuery` toQuery ("symbol", Just symbol)++data OrderBookGet ++-- | /Optional Param/ "depth" - Orderbook depth.+instance HasOptionalParam OrderBookGet Depth where+ applyOptionalParam req (Depth xs) =+ req `setQuery` toQuery ("depth", Just xs)++-- | @application/json@+instance Consumes OrderBookGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderBookGet MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderBookGet MimeJSON+-- | @application/xml@+instance Produces OrderBookGet MimeXML+-- | @text/xml@+instance Produces OrderBookGet MimeTextxml+-- | @application/javascript@+instance Produces OrderBookGet MimeJavascript+-- | @text/javascript@+instance Produces OrderBookGet MimeTextjavascript+++-- *** orderBookGetL2++-- | @GET \/orderBook\/L2@+-- +-- Get current orderbook in vertical format.+-- +orderBookGetL2 + :: Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series.+ -> BitMEXRequest OrderBookGetL2 MimeNoContent [OrderBookL2] accept+orderBookGetL2 _ (Symbol symbol) =+ _mkRequest "GET" ["/orderBook/L2"]+ `setQuery` toQuery ("symbol", Just symbol)++data OrderBookGetL2 ++-- | /Optional Param/ "depth" - Orderbook depth per side. Send 0 for full depth.+instance HasOptionalParam OrderBookGetL2 Depth where+ applyOptionalParam req (Depth xs) =+ req `setQuery` toQuery ("depth", Just xs)++-- | @application/json@+instance Consumes OrderBookGetL2 MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes OrderBookGetL2 MimeFormUrlEncoded++-- | @application/json@+instance Produces OrderBookGetL2 MimeJSON+-- | @application/xml@+instance Produces OrderBookGetL2 MimeXML+-- | @text/xml@+instance Produces OrderBookGetL2 MimeTextxml+-- | @application/javascript@+instance Produces OrderBookGetL2 MimeJavascript+-- | @text/javascript@+instance Produces OrderBookGetL2 MimeTextjavascript+++-- ** Position++-- *** positionGet++-- | @GET \/position@+-- +-- Get your positions.+-- +-- See <a href=\"http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AP_6580.html\">the FIX Spec</a> for explanations of these fields.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +positionGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest PositionGet MimeNoContent [Position] accept+positionGet _ =+ _mkRequest "GET" ["/position"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data PositionGet ++-- | /Optional Param/ "filter" - Table filter. For example, send {\"symbol\": \"XBTUSD\"}.+instance HasOptionalParam PositionGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Which columns to fetch. For example, send [\"columnName\"].+instance HasOptionalParam PositionGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of rows to fetch.+instance HasOptionalParam PositionGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | @application/json@+instance Consumes PositionGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes PositionGet MimeFormUrlEncoded++-- | @application/json@+instance Produces PositionGet MimeJSON+-- | @application/xml@+instance Produces PositionGet MimeXML+-- | @text/xml@+instance Produces PositionGet MimeTextxml+-- | @application/javascript@+instance Produces PositionGet MimeJavascript+-- | @text/javascript@+instance Produces PositionGet MimeTextjavascript+++-- *** positionIsolateMargin++-- | @POST \/position\/isolate@+-- +-- Enable isolated margin or cross margin per-position.+-- +-- Users can switch isolate margin per-position. This function allows switching margin isolation (aka fixed margin) on and off.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +positionIsolateMargin + :: (Consumes PositionIsolateMargin contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Position symbol to isolate.+ -> BitMEXRequest PositionIsolateMargin contentType Position accept+positionIsolateMargin _ _ (Symbol symbol) =+ _mkRequest "POST" ["/position/isolate"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("symbol", symbol)++data PositionIsolateMargin ++-- | /Optional Param/ "enabled" - True for isolated margin, false for cross margin.+instance HasOptionalParam PositionIsolateMargin Enabled where+ applyOptionalParam req (Enabled xs) =+ req `addForm` toForm ("enabled", xs)++-- | @application/json@+instance Consumes PositionIsolateMargin MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes PositionIsolateMargin MimeFormUrlEncoded++-- | @application/json@+instance Produces PositionIsolateMargin MimeJSON+-- | @application/xml@+instance Produces PositionIsolateMargin MimeXML+-- | @text/xml@+instance Produces PositionIsolateMargin MimeTextxml+-- | @application/javascript@+instance Produces PositionIsolateMargin MimeJavascript+-- | @text/javascript@+instance Produces PositionIsolateMargin MimeTextjavascript+++-- *** positionTransferIsolatedMargin++-- | @POST \/position\/transferMargin@+-- +-- Transfer equity in or out of a position.+-- +-- When margin is isolated on a position, use this function to add or remove margin from the position. Note that you cannot remove margin below the initial margin threshold.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +positionTransferIsolatedMargin + :: (Consumes PositionTransferIsolatedMargin contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Symbol of position to isolate.+ -> Amount -- ^ "amount" - Amount to transfer, in Satoshis. May be negative.+ -> BitMEXRequest PositionTransferIsolatedMargin contentType Position accept+positionTransferIsolatedMargin _ _ (Symbol symbol) (Amount amount) =+ _mkRequest "POST" ["/position/transferMargin"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("symbol", symbol)+ `addForm` toForm ("amount", amount)++data PositionTransferIsolatedMargin ++-- | @application/json@+instance Consumes PositionTransferIsolatedMargin MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes PositionTransferIsolatedMargin MimeFormUrlEncoded++-- | @application/json@+instance Produces PositionTransferIsolatedMargin MimeJSON+-- | @application/xml@+instance Produces PositionTransferIsolatedMargin MimeXML+-- | @text/xml@+instance Produces PositionTransferIsolatedMargin MimeTextxml+-- | @application/javascript@+instance Produces PositionTransferIsolatedMargin MimeJavascript+-- | @text/javascript@+instance Produces PositionTransferIsolatedMargin MimeTextjavascript+++-- *** positionUpdateLeverage++-- | @POST \/position\/leverage@+-- +-- Choose leverage for a position.+-- +-- Users can choose an isolated leverage. This will automatically enable isolated margin.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +positionUpdateLeverage + :: (Consumes PositionUpdateLeverage contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Symbol of position to adjust.+ -> Leverage -- ^ "leverage" - Leverage value. Send a number between 0.01 and 100 to enable isolated margin with a fixed leverage. Send 0 to enable cross margin.+ -> BitMEXRequest PositionUpdateLeverage contentType Position accept+positionUpdateLeverage _ _ (Symbol symbol) (Leverage leverage) =+ _mkRequest "POST" ["/position/leverage"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("symbol", symbol)+ `addForm` toForm ("leverage", leverage)++data PositionUpdateLeverage ++-- | @application/json@+instance Consumes PositionUpdateLeverage MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes PositionUpdateLeverage MimeFormUrlEncoded++-- | @application/json@+instance Produces PositionUpdateLeverage MimeJSON+-- | @application/xml@+instance Produces PositionUpdateLeverage MimeXML+-- | @text/xml@+instance Produces PositionUpdateLeverage MimeTextxml+-- | @application/javascript@+instance Produces PositionUpdateLeverage MimeJavascript+-- | @text/javascript@+instance Produces PositionUpdateLeverage MimeTextjavascript+++-- *** positionUpdateRiskLimit++-- | @POST \/position\/riskLimit@+-- +-- Update your risk limit.+-- +-- Risk Limits limit the size of positions you can trade at various margin levels. Larger positions require more margin. Please see the Risk Limit documentation for more details.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +positionUpdateRiskLimit + :: (Consumes PositionUpdateRiskLimit contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Symbol -- ^ "symbol" - Symbol of position to isolate.+ -> RiskLimit -- ^ "riskLimit" - New Risk Limit, in Satoshis.+ -> BitMEXRequest PositionUpdateRiskLimit contentType Position accept+positionUpdateRiskLimit _ _ (Symbol symbol) (RiskLimit riskLimit) =+ _mkRequest "POST" ["/position/riskLimit"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("symbol", symbol)+ `addForm` toForm ("riskLimit", riskLimit)++data PositionUpdateRiskLimit ++-- | @application/json@+instance Consumes PositionUpdateRiskLimit MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes PositionUpdateRiskLimit MimeFormUrlEncoded++-- | @application/json@+instance Produces PositionUpdateRiskLimit MimeJSON+-- | @application/xml@+instance Produces PositionUpdateRiskLimit MimeXML+-- | @text/xml@+instance Produces PositionUpdateRiskLimit MimeTextxml+-- | @application/javascript@+instance Produces PositionUpdateRiskLimit MimeJavascript+-- | @text/javascript@+instance Produces PositionUpdateRiskLimit MimeTextjavascript+++-- ** Quote++-- *** quoteGet++-- | @GET \/quote@+-- +-- Get Quotes.+-- +quoteGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest QuoteGet MimeNoContent [Quote] accept+quoteGet _ =+ _mkRequest "GET" ["/quote"]++data QuoteGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam QuoteGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam QuoteGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam QuoteGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam QuoteGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam QuoteGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam QuoteGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam QuoteGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam QuoteGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes QuoteGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes QuoteGet MimeFormUrlEncoded++-- | @application/json@+instance Produces QuoteGet MimeJSON+-- | @application/xml@+instance Produces QuoteGet MimeXML+-- | @text/xml@+instance Produces QuoteGet MimeTextxml+-- | @application/javascript@+instance Produces QuoteGet MimeJavascript+-- | @text/javascript@+instance Produces QuoteGet MimeTextjavascript+++-- *** quoteGetBucketed++-- | @GET \/quote\/bucketed@+-- +-- Get previous quotes in time buckets.+-- +quoteGetBucketed + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest QuoteGetBucketed MimeNoContent [Quote] accept+quoteGetBucketed _ =+ _mkRequest "GET" ["/quote/bucketed"]++data QuoteGetBucketed ++-- | /Optional Param/ "binSize" - Time interval to bucket by. Available options: [1m,5m,1h,1d].+instance HasOptionalParam QuoteGetBucketed BinSize where+ applyOptionalParam req (BinSize xs) =+ req `setQuery` toQuery ("binSize", Just xs)++-- | /Optional Param/ "partial" - If true, will send in-progress (incomplete) bins for the current time period.+instance HasOptionalParam QuoteGetBucketed Partial where+ applyOptionalParam req (Partial xs) =+ req `setQuery` toQuery ("partial", Just xs)++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam QuoteGetBucketed Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam QuoteGetBucketed Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam QuoteGetBucketed Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam QuoteGetBucketed Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam QuoteGetBucketed Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam QuoteGetBucketed Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam QuoteGetBucketed StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam QuoteGetBucketed EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes QuoteGetBucketed MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes QuoteGetBucketed MimeFormUrlEncoded++-- | @application/json@+instance Produces QuoteGetBucketed MimeJSON+-- | @application/xml@+instance Produces QuoteGetBucketed MimeXML+-- | @text/xml@+instance Produces QuoteGetBucketed MimeTextxml+-- | @application/javascript@+instance Produces QuoteGetBucketed MimeJavascript+-- | @text/javascript@+instance Produces QuoteGetBucketed MimeTextjavascript+++-- ** Schema++-- *** schemaGet++-- | @GET \/schema@+-- +-- Get model schemata for data objects returned by this API.+-- +schemaGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest SchemaGet MimeNoContent A.Value accept+schemaGet _ =+ _mkRequest "GET" ["/schema"]++data SchemaGet ++-- | /Optional Param/ "model" - Optional model filter. If omitted, will return all models.+instance HasOptionalParam SchemaGet Model where+ applyOptionalParam req (Model xs) =+ req `setQuery` toQuery ("model", Just xs)++-- | @application/json@+instance Consumes SchemaGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes SchemaGet MimeFormUrlEncoded++-- | @application/json@+instance Produces SchemaGet MimeJSON+-- | @application/xml@+instance Produces SchemaGet MimeXML+-- | @text/xml@+instance Produces SchemaGet MimeTextxml+-- | @application/javascript@+instance Produces SchemaGet MimeJavascript+-- | @text/javascript@+instance Produces SchemaGet MimeTextjavascript+++-- *** schemaWebsocketHelp++-- | @GET \/schema\/websocketHelp@+-- +-- Returns help text & subject list for websocket usage.+-- +schemaWebsocketHelp + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest SchemaWebsocketHelp MimeNoContent A.Value accept+schemaWebsocketHelp _ =+ _mkRequest "GET" ["/schema/websocketHelp"]++data SchemaWebsocketHelp ++-- | @application/json@+instance Consumes SchemaWebsocketHelp MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes SchemaWebsocketHelp MimeFormUrlEncoded++-- | @application/json@+instance Produces SchemaWebsocketHelp MimeJSON+-- | @application/xml@+instance Produces SchemaWebsocketHelp MimeXML+-- | @text/xml@+instance Produces SchemaWebsocketHelp MimeTextxml+-- | @application/javascript@+instance Produces SchemaWebsocketHelp MimeJavascript+-- | @text/javascript@+instance Produces SchemaWebsocketHelp MimeTextjavascript+++-- ** Settlement++-- *** settlementGet++-- | @GET \/settlement@+-- +-- Get settlement history.+-- +settlementGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest SettlementGet MimeNoContent [Settlement] accept+settlementGet _ =+ _mkRequest "GET" ["/settlement"]++data SettlementGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam SettlementGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam SettlementGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam SettlementGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam SettlementGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam SettlementGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam SettlementGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam SettlementGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam SettlementGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes SettlementGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes SettlementGet MimeFormUrlEncoded++-- | @application/json@+instance Produces SettlementGet MimeJSON+-- | @application/xml@+instance Produces SettlementGet MimeXML+-- | @text/xml@+instance Produces SettlementGet MimeTextxml+-- | @application/javascript@+instance Produces SettlementGet MimeJavascript+-- | @text/javascript@+instance Produces SettlementGet MimeTextjavascript+++-- ** Stats++-- *** statsGet++-- | @GET \/stats@+-- +-- Get exchange-wide and per-series turnover and volume statistics.+-- +statsGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest StatsGet MimeNoContent [Stats] accept+statsGet _ =+ _mkRequest "GET" ["/stats"]++data StatsGet ++-- | @application/json@+instance Consumes StatsGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes StatsGet MimeFormUrlEncoded++-- | @application/json@+instance Produces StatsGet MimeJSON+-- | @application/xml@+instance Produces StatsGet MimeXML+-- | @text/xml@+instance Produces StatsGet MimeTextxml+-- | @application/javascript@+instance Produces StatsGet MimeJavascript+-- | @text/javascript@+instance Produces StatsGet MimeTextjavascript+++-- *** statsHistory2++-- | @GET \/stats\/history@+-- +-- Get historical exchange-wide and per-series turnover and volume statistics.+-- +statsHistory2 + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest StatsHistory2 MimeNoContent [StatsHistory] accept+statsHistory2 _ =+ _mkRequest "GET" ["/stats/history"]++data StatsHistory2 ++-- | @application/json@+instance Consumes StatsHistory2 MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes StatsHistory2 MimeFormUrlEncoded++-- | @application/json@+instance Produces StatsHistory2 MimeJSON+-- | @application/xml@+instance Produces StatsHistory2 MimeXML+-- | @text/xml@+instance Produces StatsHistory2 MimeTextxml+-- | @application/javascript@+instance Produces StatsHistory2 MimeJavascript+-- | @text/javascript@+instance Produces StatsHistory2 MimeTextjavascript+++-- *** statsHistoryUSD++-- | @GET \/stats\/historyUSD@+-- +-- Get a summary of exchange statistics in USD.+-- +statsHistoryUSD + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest StatsHistoryUSD MimeNoContent [StatsUSD] accept+statsHistoryUSD _ =+ _mkRequest "GET" ["/stats/historyUSD"]++data StatsHistoryUSD ++-- | @application/json@+instance Consumes StatsHistoryUSD MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes StatsHistoryUSD MimeFormUrlEncoded++-- | @application/json@+instance Produces StatsHistoryUSD MimeJSON+-- | @application/xml@+instance Produces StatsHistoryUSD MimeXML+-- | @text/xml@+instance Produces StatsHistoryUSD MimeTextxml+-- | @application/javascript@+instance Produces StatsHistoryUSD MimeJavascript+-- | @text/javascript@+instance Produces StatsHistoryUSD MimeTextjavascript+++-- ** Trade++-- *** tradeGet++-- | @GET \/trade@+-- +-- Get Trades.+-- +-- Please note that indices (symbols starting with `.`) post trades at intervals to the trade feed. These have a `size` of 0 and are used only to indicate a changing price. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AE_6569.html) for explanations of these fields.+-- +tradeGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest TradeGet MimeNoContent [Trade] accept+tradeGet _ =+ _mkRequest "GET" ["/trade"]++data TradeGet ++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam TradeGet Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam TradeGet Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam TradeGet Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam TradeGet Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam TradeGet Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam TradeGet Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam TradeGet StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam TradeGet EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes TradeGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes TradeGet MimeFormUrlEncoded++-- | @application/json@+instance Produces TradeGet MimeJSON+-- | @application/xml@+instance Produces TradeGet MimeXML+-- | @text/xml@+instance Produces TradeGet MimeTextxml+-- | @application/javascript@+instance Produces TradeGet MimeJavascript+-- | @text/javascript@+instance Produces TradeGet MimeTextjavascript+++-- *** tradeGetBucketed++-- | @GET \/trade\/bucketed@+-- +-- Get previous trades in time buckets.+-- +tradeGetBucketed + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest TradeGetBucketed MimeNoContent [TradeBin] accept+tradeGetBucketed _ =+ _mkRequest "GET" ["/trade/bucketed"]++data TradeGetBucketed ++-- | /Optional Param/ "binSize" - Time interval to bucket by. Available options: [1m,5m,1h,1d].+instance HasOptionalParam TradeGetBucketed BinSize where+ applyOptionalParam req (BinSize xs) =+ req `setQuery` toQuery ("binSize", Just xs)++-- | /Optional Param/ "partial" - If true, will send in-progress (incomplete) bins for the current time period.+instance HasOptionalParam TradeGetBucketed Partial where+ applyOptionalParam req (Partial xs) =+ req `setQuery` toQuery ("partial", Just xs)++-- | /Optional Param/ "symbol" - Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.+instance HasOptionalParam TradeGetBucketed Symbol where+ applyOptionalParam req (Symbol xs) =+ req `setQuery` toQuery ("symbol", Just xs)++-- | /Optional Param/ "filter" - Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.+instance HasOptionalParam TradeGetBucketed Filter where+ applyOptionalParam req (Filter xs) =+ req `setQuery` toQuery ("filter", Just xs)++-- | /Optional Param/ "columns" - Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.+instance HasOptionalParam TradeGetBucketed Columns where+ applyOptionalParam req (Columns xs) =+ req `setQuery` toQuery ("columns", Just xs)++-- | /Optional Param/ "count" - Number of results to fetch.+instance HasOptionalParam TradeGetBucketed Count where+ applyOptionalParam req (Count xs) =+ req `setQuery` toQuery ("count", Just xs)++-- | /Optional Param/ "start" - Starting point for results.+instance HasOptionalParam TradeGetBucketed Start where+ applyOptionalParam req (Start xs) =+ req `setQuery` toQuery ("start", Just xs)++-- | /Optional Param/ "reverse" - If true, will sort results newest first.+instance HasOptionalParam TradeGetBucketed Reverse where+ applyOptionalParam req (Reverse xs) =+ req `setQuery` toQuery ("reverse", Just xs)++-- | /Optional Param/ "startTime" - Starting date filter for results.+instance HasOptionalParam TradeGetBucketed StartTime where+ applyOptionalParam req (StartTime xs) =+ req `setQuery` toQuery ("startTime", Just xs)++-- | /Optional Param/ "endTime" - Ending date filter for results.+instance HasOptionalParam TradeGetBucketed EndTime where+ applyOptionalParam req (EndTime xs) =+ req `setQuery` toQuery ("endTime", Just xs)++-- | @application/json@+instance Consumes TradeGetBucketed MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes TradeGetBucketed MimeFormUrlEncoded++-- | @application/json@+instance Produces TradeGetBucketed MimeJSON+-- | @application/xml@+instance Produces TradeGetBucketed MimeXML+-- | @text/xml@+instance Produces TradeGetBucketed MimeTextxml+-- | @application/javascript@+instance Produces TradeGetBucketed MimeJavascript+-- | @text/javascript@+instance Produces TradeGetBucketed MimeTextjavascript+++-- ** User++-- *** userCancelWithdrawal++-- | @POST \/user\/cancelWithdrawal@+-- +-- Cancel a withdrawal.+-- +userCancelWithdrawal + :: (Consumes UserCancelWithdrawal contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Token -- ^ "token"+ -> BitMEXRequest UserCancelWithdrawal contentType Transaction accept+userCancelWithdrawal _ _ (Token token) =+ _mkRequest "POST" ["/user/cancelWithdrawal"]+ `addForm` toForm ("token", token)++data UserCancelWithdrawal ++-- | @application/json@+instance Consumes UserCancelWithdrawal MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserCancelWithdrawal MimeFormUrlEncoded++-- | @application/json@+instance Produces UserCancelWithdrawal MimeJSON+-- | @application/xml@+instance Produces UserCancelWithdrawal MimeXML+-- | @text/xml@+instance Produces UserCancelWithdrawal MimeTextxml+-- | @application/javascript@+instance Produces UserCancelWithdrawal MimeJavascript+-- | @text/javascript@+instance Produces UserCancelWithdrawal MimeTextjavascript+++-- *** userCheckReferralCode++-- | @GET \/user\/checkReferralCode@+-- +-- Check if a referral code is valid.+-- +-- If the code is valid, responds with the referral code's discount (e.g. `0.1` for 10%). Otherwise, will return a 404.+-- +userCheckReferralCode + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserCheckReferralCode MimeNoContent Double accept+userCheckReferralCode _ =+ _mkRequest "GET" ["/user/checkReferralCode"]++data UserCheckReferralCode +instance HasOptionalParam UserCheckReferralCode ReferralCode where+ applyOptionalParam req (ReferralCode xs) =+ req `setQuery` toQuery ("referralCode", Just xs)++-- | @application/json@+instance Consumes UserCheckReferralCode MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserCheckReferralCode MimeFormUrlEncoded++-- | @application/json@+instance Produces UserCheckReferralCode MimeJSON+-- | @application/xml@+instance Produces UserCheckReferralCode MimeXML+-- | @text/xml@+instance Produces UserCheckReferralCode MimeTextxml+-- | @application/javascript@+instance Produces UserCheckReferralCode MimeJavascript+-- | @text/javascript@+instance Produces UserCheckReferralCode MimeTextjavascript+++-- *** userConfirm++-- | @POST \/user\/confirmEmail@+-- +-- Confirm your email address with a token.+-- +userConfirm + :: (Consumes UserConfirm contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Token -- ^ "token"+ -> BitMEXRequest UserConfirm contentType AccessToken accept+userConfirm _ _ (Token token) =+ _mkRequest "POST" ["/user/confirmEmail"]+ `addForm` toForm ("token", token)++data UserConfirm ++-- | @application/json@+instance Consumes UserConfirm MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserConfirm MimeFormUrlEncoded++-- | @application/json@+instance Produces UserConfirm MimeJSON+-- | @application/xml@+instance Produces UserConfirm MimeXML+-- | @text/xml@+instance Produces UserConfirm MimeTextxml+-- | @application/javascript@+instance Produces UserConfirm MimeJavascript+-- | @text/javascript@+instance Produces UserConfirm MimeTextjavascript+++-- *** userConfirmEnableTFA++-- | @POST \/user\/confirmEnableTFA@+-- +-- Confirm two-factor auth for this account. If using a Yubikey, simply send a token to this endpoint.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userConfirmEnableTFA + :: (Consumes UserConfirmEnableTFA contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Token -- ^ "token" - Token from your selected TFA type.+ -> BitMEXRequest UserConfirmEnableTFA contentType Bool accept+userConfirmEnableTFA _ _ (Token token) =+ _mkRequest "POST" ["/user/confirmEnableTFA"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("token", token)++data UserConfirmEnableTFA ++-- | /Optional Param/ "type" - Two-factor auth type. Supported types: 'GA' (Google Authenticator), 'Yubikey'+instance HasOptionalParam UserConfirmEnableTFA ParamType where+ applyOptionalParam req (ParamType xs) =+ req `addForm` toForm ("type", xs)++-- | @application/json@+instance Consumes UserConfirmEnableTFA MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserConfirmEnableTFA MimeFormUrlEncoded++-- | @application/json@+instance Produces UserConfirmEnableTFA MimeJSON+-- | @application/xml@+instance Produces UserConfirmEnableTFA MimeXML+-- | @text/xml@+instance Produces UserConfirmEnableTFA MimeTextxml+-- | @application/javascript@+instance Produces UserConfirmEnableTFA MimeJavascript+-- | @text/javascript@+instance Produces UserConfirmEnableTFA MimeTextjavascript+++-- *** userConfirmWithdrawal++-- | @POST \/user\/confirmWithdrawal@+-- +-- Confirm a withdrawal.+-- +userConfirmWithdrawal + :: (Consumes UserConfirmWithdrawal contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Token -- ^ "token"+ -> BitMEXRequest UserConfirmWithdrawal contentType Transaction accept+userConfirmWithdrawal _ _ (Token token) =+ _mkRequest "POST" ["/user/confirmWithdrawal"]+ `addForm` toForm ("token", token)++data UserConfirmWithdrawal ++-- | @application/json@+instance Consumes UserConfirmWithdrawal MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserConfirmWithdrawal MimeFormUrlEncoded++-- | @application/json@+instance Produces UserConfirmWithdrawal MimeJSON+-- | @application/xml@+instance Produces UserConfirmWithdrawal MimeXML+-- | @text/xml@+instance Produces UserConfirmWithdrawal MimeTextxml+-- | @application/javascript@+instance Produces UserConfirmWithdrawal MimeJavascript+-- | @text/javascript@+instance Produces UserConfirmWithdrawal MimeTextjavascript+++-- *** userDisableTFA++-- | @POST \/user\/disableTFA@+-- +-- Disable two-factor auth for this account.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userDisableTFA + :: (Consumes UserDisableTFA contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Token -- ^ "token" - Token from your selected TFA type.+ -> BitMEXRequest UserDisableTFA contentType Bool accept+userDisableTFA _ _ (Token token) =+ _mkRequest "POST" ["/user/disableTFA"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("token", token)++data UserDisableTFA ++-- | /Optional Param/ "type" - Two-factor auth type. Supported types: 'GA' (Google Authenticator)+instance HasOptionalParam UserDisableTFA ParamType where+ applyOptionalParam req (ParamType xs) =+ req `addForm` toForm ("type", xs)++-- | @application/json@+instance Consumes UserDisableTFA MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserDisableTFA MimeFormUrlEncoded++-- | @application/json@+instance Produces UserDisableTFA MimeJSON+-- | @application/xml@+instance Produces UserDisableTFA MimeXML+-- | @text/xml@+instance Produces UserDisableTFA MimeTextxml+-- | @application/javascript@+instance Produces UserDisableTFA MimeJavascript+-- | @text/javascript@+instance Produces UserDisableTFA MimeTextjavascript+++-- *** userGet++-- | @GET \/user@+-- +-- Get your user model.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGet MimeNoContent User accept+userGet _ =+ _mkRequest "GET" ["/user"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGet ++-- | @application/json@+instance Consumes UserGet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGet MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGet MimeJSON+-- | @application/xml@+instance Produces UserGet MimeXML+-- | @text/xml@+instance Produces UserGet MimeTextxml+-- | @application/javascript@+instance Produces UserGet MimeJavascript+-- | @text/javascript@+instance Produces UserGet MimeTextjavascript+++-- *** userGetAffiliateStatus++-- | @GET \/user\/affiliateStatus@+-- +-- Get your current affiliate/referral status.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetAffiliateStatus + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetAffiliateStatus MimeNoContent Affiliate accept+userGetAffiliateStatus _ =+ _mkRequest "GET" ["/user/affiliateStatus"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetAffiliateStatus ++-- | @application/json@+instance Consumes UserGetAffiliateStatus MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetAffiliateStatus MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetAffiliateStatus MimeJSON+-- | @application/xml@+instance Produces UserGetAffiliateStatus MimeXML+-- | @text/xml@+instance Produces UserGetAffiliateStatus MimeTextxml+-- | @application/javascript@+instance Produces UserGetAffiliateStatus MimeJavascript+-- | @text/javascript@+instance Produces UserGetAffiliateStatus MimeTextjavascript+++-- *** userGetCommission++-- | @GET \/user\/commission@+-- +-- Get your account's commission status.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetCommission + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetCommission MimeNoContent [UserCommission] accept+userGetCommission _ =+ _mkRequest "GET" ["/user/commission"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetCommission ++-- | @application/json@+instance Consumes UserGetCommission MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetCommission MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetCommission MimeJSON+-- | @application/xml@+instance Produces UserGetCommission MimeXML+-- | @text/xml@+instance Produces UserGetCommission MimeTextxml+-- | @application/javascript@+instance Produces UserGetCommission MimeJavascript+-- | @text/javascript@+instance Produces UserGetCommission MimeTextjavascript+++-- *** userGetDepositAddress++-- | @GET \/user\/depositAddress@+-- +-- Get a deposit address.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetDepositAddress + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetDepositAddress MimeNoContent Text accept+userGetDepositAddress _ =+ _mkRequest "GET" ["/user/depositAddress"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetDepositAddress +instance HasOptionalParam UserGetDepositAddress Currency where+ applyOptionalParam req (Currency xs) =+ req `setQuery` toQuery ("currency", Just xs)++-- | @application/json@+instance Consumes UserGetDepositAddress MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetDepositAddress MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetDepositAddress MimeJSON+-- | @application/xml@+instance Produces UserGetDepositAddress MimeXML+-- | @text/xml@+instance Produces UserGetDepositAddress MimeTextxml+-- | @application/javascript@+instance Produces UserGetDepositAddress MimeJavascript+-- | @text/javascript@+instance Produces UserGetDepositAddress MimeTextjavascript+++-- *** userGetMargin++-- | @GET \/user\/margin@+-- +-- Get your account's margin status. Send a currency of \"all\" to receive an array of all supported currencies.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetMargin + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetMargin MimeNoContent Margin accept+userGetMargin _ =+ _mkRequest "GET" ["/user/margin"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetMargin +instance HasOptionalParam UserGetMargin Currency where+ applyOptionalParam req (Currency xs) =+ req `setQuery` toQuery ("currency", Just xs)++-- | @application/json@+instance Consumes UserGetMargin MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetMargin MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetMargin MimeJSON+-- | @application/xml@+instance Produces UserGetMargin MimeXML+-- | @text/xml@+instance Produces UserGetMargin MimeTextxml+-- | @application/javascript@+instance Produces UserGetMargin MimeJavascript+-- | @text/javascript@+instance Produces UserGetMargin MimeTextjavascript+++-- *** userGetWallet++-- | @GET \/user\/wallet@+-- +-- Get your current wallet information.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetWallet + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetWallet MimeNoContent Wallet accept+userGetWallet _ =+ _mkRequest "GET" ["/user/wallet"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetWallet +instance HasOptionalParam UserGetWallet Currency where+ applyOptionalParam req (Currency xs) =+ req `setQuery` toQuery ("currency", Just xs)++-- | @application/json@+instance Consumes UserGetWallet MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetWallet MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetWallet MimeJSON+-- | @application/xml@+instance Produces UserGetWallet MimeXML+-- | @text/xml@+instance Produces UserGetWallet MimeTextxml+-- | @application/javascript@+instance Produces UserGetWallet MimeJavascript+-- | @text/javascript@+instance Produces UserGetWallet MimeTextjavascript+++-- *** userGetWalletHistory++-- | @GET \/user\/walletHistory@+-- +-- Get a history of all of your wallet transactions (deposits, withdrawals, PNL).+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetWalletHistory + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetWalletHistory MimeNoContent [Transaction] accept+userGetWalletHistory _ =+ _mkRequest "GET" ["/user/walletHistory"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetWalletHistory +instance HasOptionalParam UserGetWalletHistory Currency where+ applyOptionalParam req (Currency xs) =+ req `setQuery` toQuery ("currency", Just xs)++-- | @application/json@+instance Consumes UserGetWalletHistory MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetWalletHistory MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetWalletHistory MimeJSON+-- | @application/xml@+instance Produces UserGetWalletHistory MimeXML+-- | @text/xml@+instance Produces UserGetWalletHistory MimeTextxml+-- | @application/javascript@+instance Produces UserGetWalletHistory MimeJavascript+-- | @text/javascript@+instance Produces UserGetWalletHistory MimeTextjavascript+++-- *** userGetWalletSummary++-- | @GET \/user\/walletSummary@+-- +-- Get a summary of all of your wallet transactions (deposits, withdrawals, PNL).+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userGetWalletSummary + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserGetWalletSummary MimeNoContent [Transaction] accept+userGetWalletSummary _ =+ _mkRequest "GET" ["/user/walletSummary"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserGetWalletSummary +instance HasOptionalParam UserGetWalletSummary Currency where+ applyOptionalParam req (Currency xs) =+ req `setQuery` toQuery ("currency", Just xs)++-- | @application/json@+instance Consumes UserGetWalletSummary MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserGetWalletSummary MimeFormUrlEncoded++-- | @application/json@+instance Produces UserGetWalletSummary MimeJSON+-- | @application/xml@+instance Produces UserGetWalletSummary MimeXML+-- | @text/xml@+instance Produces UserGetWalletSummary MimeTextxml+-- | @application/javascript@+instance Produces UserGetWalletSummary MimeJavascript+-- | @text/javascript@+instance Produces UserGetWalletSummary MimeTextjavascript+++-- *** userLogout++-- | @POST \/user\/logout@+-- +-- Log out of BitMEX.+-- +-- Note: Has 'Produces' instances, but no response schema+-- +userLogout + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserLogout MimeNoContent res accept+userLogout _ =+ _mkRequest "POST" ["/user/logout"]++data UserLogout ++-- | @application/json@+instance Consumes UserLogout MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserLogout MimeFormUrlEncoded++-- | @application/json@+instance Produces UserLogout MimeJSON+-- | @application/xml@+instance Produces UserLogout MimeXML+-- | @text/xml@+instance Produces UserLogout MimeTextxml+-- | @application/javascript@+instance Produces UserLogout MimeJavascript+-- | @text/javascript@+instance Produces UserLogout MimeTextjavascript+++-- *** userLogoutAll++-- | @POST \/user\/logoutAll@+-- +-- Log all systems out of BitMEX. This will revoke all of your account's access tokens, logging you out on all devices.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userLogoutAll + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserLogoutAll MimeNoContent Double accept+userLogoutAll _ =+ _mkRequest "POST" ["/user/logoutAll"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserLogoutAll ++-- | @application/json@+instance Consumes UserLogoutAll MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserLogoutAll MimeFormUrlEncoded++-- | @application/json@+instance Produces UserLogoutAll MimeJSON+-- | @application/xml@+instance Produces UserLogoutAll MimeXML+-- | @text/xml@+instance Produces UserLogoutAll MimeTextxml+-- | @application/javascript@+instance Produces UserLogoutAll MimeJavascript+-- | @text/javascript@+instance Produces UserLogoutAll MimeTextjavascript+++-- *** userMinWithdrawalFee++-- | @GET \/user\/minWithdrawalFee@+-- +-- Get the minimum withdrawal fee for a currency.+-- +-- This is changed based on network conditions to ensure timely withdrawals. During network congestion, this may be high. The fee is returned in the same currency.+-- +userMinWithdrawalFee + :: Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserMinWithdrawalFee MimeNoContent A.Value accept+userMinWithdrawalFee _ =+ _mkRequest "GET" ["/user/minWithdrawalFee"]++data UserMinWithdrawalFee +instance HasOptionalParam UserMinWithdrawalFee Currency where+ applyOptionalParam req (Currency xs) =+ req `setQuery` toQuery ("currency", Just xs)++-- | @application/json@+instance Consumes UserMinWithdrawalFee MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserMinWithdrawalFee MimeFormUrlEncoded++-- | @application/json@+instance Produces UserMinWithdrawalFee MimeJSON+-- | @application/xml@+instance Produces UserMinWithdrawalFee MimeXML+-- | @text/xml@+instance Produces UserMinWithdrawalFee MimeTextxml+-- | @application/javascript@+instance Produces UserMinWithdrawalFee MimeJavascript+-- | @text/javascript@+instance Produces UserMinWithdrawalFee MimeTextjavascript+++-- *** userRequestEnableTFA++-- | @POST \/user\/requestEnableTFA@+-- +-- Get secret key for setting up two-factor auth.+-- +-- Use /confirmEnableTFA directly for Yubikeys. This fails if TFA is already enabled.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userRequestEnableTFA + :: (Consumes UserRequestEnableTFA contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserRequestEnableTFA contentType Bool accept+userRequestEnableTFA _ _ =+ _mkRequest "POST" ["/user/requestEnableTFA"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserRequestEnableTFA ++-- | /Optional Param/ "type" - Two-factor auth type. Supported types: 'GA' (Google Authenticator)+instance HasOptionalParam UserRequestEnableTFA ParamType where+ applyOptionalParam req (ParamType xs) =+ req `addForm` toForm ("type", xs)++-- | @application/json@+instance Consumes UserRequestEnableTFA MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserRequestEnableTFA MimeFormUrlEncoded++-- | @application/json@+instance Produces UserRequestEnableTFA MimeJSON+-- | @application/xml@+instance Produces UserRequestEnableTFA MimeXML+-- | @text/xml@+instance Produces UserRequestEnableTFA MimeTextxml+-- | @application/javascript@+instance Produces UserRequestEnableTFA MimeJavascript+-- | @text/javascript@+instance Produces UserRequestEnableTFA MimeTextjavascript+++-- *** userRequestWithdrawal++-- | @POST \/user\/requestWithdrawal@+-- +-- Request a withdrawal to an external wallet.+-- +-- This will send a confirmation email to the email address on record, unless requested via an API Key with the `withdraw` permission.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userRequestWithdrawal + :: (Consumes UserRequestWithdrawal contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Currency -- ^ "currency" - Currency you're withdrawing. Options: `XBt`+ -> Amount -- ^ "amount" - Amount of withdrawal currency.+ -> Address -- ^ "address" - Destination Address.+ -> BitMEXRequest UserRequestWithdrawal contentType Transaction accept+userRequestWithdrawal _ _ (Currency currency) (Amount amount) (Address address) =+ _mkRequest "POST" ["/user/requestWithdrawal"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("currency", currency)+ `addForm` toForm ("amount", amount)+ `addForm` toForm ("address", address)++data UserRequestWithdrawal ++-- | /Optional Param/ "otpToken" - 2FA token. Required if 2FA is enabled on your account.+instance HasOptionalParam UserRequestWithdrawal OtpToken where+ applyOptionalParam req (OtpToken xs) =+ req `addForm` toForm ("otpToken", xs)++-- | /Optional Param/ "fee" - Network fee for Bitcoin withdrawals. If not specified, a default value will be calculated based on Bitcoin network conditions. You will have a chance to confirm this via email.+instance HasOptionalParam UserRequestWithdrawal Fee where+ applyOptionalParam req (Fee xs) =+ req `addForm` toForm ("fee", xs)++-- | @application/json@+instance Consumes UserRequestWithdrawal MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserRequestWithdrawal MimeFormUrlEncoded++-- | @application/json@+instance Produces UserRequestWithdrawal MimeJSON+-- | @application/xml@+instance Produces UserRequestWithdrawal MimeXML+-- | @text/xml@+instance Produces UserRequestWithdrawal MimeTextxml+-- | @application/javascript@+instance Produces UserRequestWithdrawal MimeJavascript+-- | @text/javascript@+instance Produces UserRequestWithdrawal MimeTextjavascript+++-- *** userSavePreferences++-- | @POST \/user\/preferences@+-- +-- Save user preferences.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userSavePreferences + :: (Consumes UserSavePreferences contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> Prefs -- ^ "prefs"+ -> BitMEXRequest UserSavePreferences contentType User accept+userSavePreferences _ _ (Prefs prefs) =+ _mkRequest "POST" ["/user/preferences"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)+ `addForm` toForm ("prefs", prefs)++data UserSavePreferences ++-- | /Optional Param/ "overwrite" - If true, will overwrite all existing preferences.+instance HasOptionalParam UserSavePreferences Overwrite where+ applyOptionalParam req (Overwrite xs) =+ req `addForm` toForm ("overwrite", xs)++-- | @application/json@+instance Consumes UserSavePreferences MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserSavePreferences MimeFormUrlEncoded++-- | @application/json@+instance Produces UserSavePreferences MimeJSON+-- | @application/xml@+instance Produces UserSavePreferences MimeXML+-- | @text/xml@+instance Produces UserSavePreferences MimeTextxml+-- | @application/javascript@+instance Produces UserSavePreferences MimeJavascript+-- | @text/javascript@+instance Produces UserSavePreferences MimeTextjavascript+++-- *** userUpdate++-- | @PUT \/user@+-- +-- Update your password, name, and other attributes.+-- +-- AuthMethod: 'AuthApiKeyApiKey', 'AuthApiKeyApiNonce', 'AuthApiKeyApiSignature'+-- +userUpdate + :: (Consumes UserUpdate contentType)+ => ContentType contentType -- ^ request content-type ('MimeType')+ -> Accept accept -- ^ request accept ('MimeType')+ -> BitMEXRequest UserUpdate contentType User accept+userUpdate _ _ =+ _mkRequest "PUT" ["/user"]+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiNonce)+ `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiSignature)++data UserUpdate +instance HasOptionalParam UserUpdate Firstname where+ applyOptionalParam req (Firstname xs) =+ req `addForm` toForm ("firstname", xs)+instance HasOptionalParam UserUpdate Lastname where+ applyOptionalParam req (Lastname xs) =+ req `addForm` toForm ("lastname", xs)+instance HasOptionalParam UserUpdate OldPassword where+ applyOptionalParam req (OldPassword xs) =+ req `addForm` toForm ("oldPassword", xs)+instance HasOptionalParam UserUpdate NewPassword where+ applyOptionalParam req (NewPassword xs) =+ req `addForm` toForm ("newPassword", xs)+instance HasOptionalParam UserUpdate NewPasswordConfirm where+ applyOptionalParam req (NewPasswordConfirm xs) =+ req `addForm` toForm ("newPasswordConfirm", xs)++-- | /Optional Param/ "username" - Username can only be set once. To reset, email support.+instance HasOptionalParam UserUpdate Username where+ applyOptionalParam req (Username xs) =+ req `addForm` toForm ("username", xs)++-- | /Optional Param/ "country" - Country of residence.+instance HasOptionalParam UserUpdate Country where+ applyOptionalParam req (Country xs) =+ req `addForm` toForm ("country", xs)++-- | /Optional Param/ "pgpPubKey" - PGP Public Key. If specified, automated emails will be sentwith this key.+instance HasOptionalParam UserUpdate PgpPubKey where+ applyOptionalParam req (PgpPubKey xs) =+ req `addForm` toForm ("pgpPubKey", xs)++-- | @application/json@+instance Consumes UserUpdate MimeJSON+-- | @application/x-www-form-urlencoded@+instance Consumes UserUpdate MimeFormUrlEncoded++-- | @application/json@+instance Produces UserUpdate MimeJSON+-- | @application/xml@+instance Produces UserUpdate MimeXML+-- | @text/xml@+instance Produces UserUpdate MimeTextxml+-- | @application/javascript@+instance Produces UserUpdate MimeJavascript+-- | @text/javascript@+instance Produces UserUpdate MimeTextjavascript++++-- * Parameter newtypes++newtype Account = Account { unAccount :: Double } deriving (P.Eq, P.Show)+newtype Address = Address { unAddress :: Text } deriving (P.Eq, P.Show)+newtype Amount = Amount { unAmount :: Double } deriving (P.Eq, P.Show)+newtype ApiKeyId = ApiKeyId { unApiKeyId :: Text } deriving (P.Eq, P.Show)+newtype BinSize = BinSize { unBinSize :: Text } deriving (P.Eq, P.Show)+newtype ChannelId = ChannelId { unChannelId :: Double } deriving (P.Eq, P.Show)+newtype Cidr = Cidr { unCidr :: Text } deriving (P.Eq, P.Show)+newtype ClOrdId = ClOrdId { unClOrdId :: Text } deriving (P.Eq, P.Show)+newtype ClOrdLinkId = ClOrdLinkId { unClOrdLinkId :: Text } deriving (P.Eq, P.Show)+newtype Columns = Columns { unColumns :: Text } deriving (P.Eq, P.Show)+newtype ContingencyType = ContingencyType { unContingencyType :: Text } deriving (P.Eq, P.Show)+newtype Count = Count { unCount :: Double } deriving (P.Eq, P.Show)+newtype Country = Country { unCountry :: Text } deriving (P.Eq, P.Show)+newtype Currency = Currency { unCurrency :: Text } deriving (P.Eq, P.Show)+newtype Depth = Depth { unDepth :: Double } deriving (P.Eq, P.Show)+newtype DisplayQty = DisplayQty { unDisplayQty :: Double } deriving (P.Eq, P.Show)+newtype Enabled = Enabled { unEnabled :: Bool } deriving (P.Eq, P.Show)+newtype EndTime = EndTime { unEndTime :: DateTime } deriving (P.Eq, P.Show)+newtype ExecInst = ExecInst { unExecInst :: Text } deriving (P.Eq, P.Show)+newtype Fee = Fee { unFee :: Double } deriving (P.Eq, P.Show)+newtype Filter = Filter { unFilter :: Text } deriving (P.Eq, P.Show)+newtype Firstname = Firstname { unFirstname :: Text } deriving (P.Eq, P.Show)+newtype Lastname = Lastname { unLastname :: Text } deriving (P.Eq, P.Show)+newtype LeavesQty = LeavesQty { unLeavesQty :: Double } deriving (P.Eq, P.Show)+newtype Leverage = Leverage { unLeverage :: Double } deriving (P.Eq, P.Show)+newtype Message = Message { unMessage :: Text } deriving (P.Eq, P.Show)+newtype Method = Method { unMethod :: Text } deriving (P.Eq, P.Show)+newtype Model = Model { unModel :: Text } deriving (P.Eq, P.Show)+newtype Name = Name { unName :: Text } deriving (P.Eq, P.Show)+newtype NewPassword = NewPassword { unNewPassword :: Text } deriving (P.Eq, P.Show)+newtype NewPasswordConfirm = NewPasswordConfirm { unNewPasswordConfirm :: Text } deriving (P.Eq, P.Show)+newtype OldPassword = OldPassword { unOldPassword :: Text } deriving (P.Eq, P.Show)+newtype OrdType = OrdType { unOrdType :: Text } deriving (P.Eq, P.Show)+newtype OrderId = OrderId { unOrderId :: Text } deriving (P.Eq, P.Show)+newtype OrderQty = OrderQty { unOrderQty :: Double } deriving (P.Eq, P.Show)+newtype Orders = Orders { unOrders :: Text } deriving (P.Eq, P.Show)+newtype OrigClOrdId = OrigClOrdId { unOrigClOrdId :: Text } deriving (P.Eq, P.Show)+newtype OtpToken = OtpToken { unOtpToken :: Text } deriving (P.Eq, P.Show)+newtype Overwrite = Overwrite { unOverwrite :: Bool } deriving (P.Eq, P.Show)+newtype ParamText = ParamText { unParamText :: Text } deriving (P.Eq, P.Show)+newtype ParamType = ParamType { unParamType :: Text } deriving (P.Eq, P.Show)+newtype Partial = Partial { unPartial :: Bool } deriving (P.Eq, P.Show)+newtype PegOffsetValue = PegOffsetValue { unPegOffsetValue :: Double } deriving (P.Eq, P.Show)+newtype PegPriceType = PegPriceType { unPegPriceType :: Text } deriving (P.Eq, P.Show)+newtype Permissions = Permissions { unPermissions :: Text } deriving (P.Eq, P.Show)+newtype PgpPubKey = PgpPubKey { unPgpPubKey :: Text } deriving (P.Eq, P.Show)+newtype Prefs = Prefs { unPrefs :: Text } deriving (P.Eq, P.Show)+newtype Price = Price { unPrice :: Double } deriving (P.Eq, P.Show)+newtype Quantity = Quantity { unQuantity :: Double } deriving (P.Eq, P.Show)+newtype ReferralCode = ReferralCode { unReferralCode :: Text } deriving (P.Eq, P.Show)+newtype Reverse = Reverse { unReverse :: Bool } deriving (P.Eq, P.Show)+newtype RiskLimit = RiskLimit { unRiskLimit :: Double } deriving (P.Eq, P.Show)+newtype Side = Side { unSide :: Text } deriving (P.Eq, P.Show)+newtype SimpleLeavesQty = SimpleLeavesQty { unSimpleLeavesQty :: Double } deriving (P.Eq, P.Show)+newtype SimpleOrderQty = SimpleOrderQty { unSimpleOrderQty :: Double } deriving (P.Eq, P.Show)+newtype Start = Start { unStart :: Double } deriving (P.Eq, P.Show)+newtype StartTime = StartTime { unStartTime :: DateTime } deriving (P.Eq, P.Show)+newtype StopPrice = StopPrice { unStopPrice :: Double } deriving (P.Eq, P.Show)+newtype StopPx = StopPx { unStopPx :: Double } deriving (P.Eq, P.Show)+newtype Symbol = Symbol { unSymbol :: Text } deriving (P.Eq, P.Show)+newtype TimeInForce = TimeInForce { unTimeInForce :: Text } deriving (P.Eq, P.Show)+newtype Timeout = Timeout { unTimeout :: Double } deriving (P.Eq, P.Show)+newtype Token = Token { unToken :: Text } deriving (P.Eq, P.Show)+newtype Username = Username { unUsername :: Text } deriving (P.Eq, P.Show)++-- * Auth Methods++-- ** AuthApiKeyApiKey+data AuthApiKeyApiKey =+ AuthApiKeyApiKey Text -- ^ secret+ deriving (P.Eq, P.Show, P.Typeable)++instance AuthMethod AuthApiKeyApiKey where+ applyAuthMethod _ a@(AuthApiKeyApiKey secret) req =+ P.pure $+ if (P.typeOf a `P.elem` rAuthTypes req)+ then req `setHeader` toHeader ("api-key", secret)+ & L.over rAuthTypesL (P.filter (/= P.typeOf a))+ else req++-- ** AuthApiKeyApiNonce+data AuthApiKeyApiNonce =+ AuthApiKeyApiNonce Text -- ^ secret+ deriving (P.Eq, P.Show, P.Typeable)++instance AuthMethod AuthApiKeyApiNonce where+ applyAuthMethod _ a@(AuthApiKeyApiNonce secret) req =+ P.pure $+ if (P.typeOf a `P.elem` rAuthTypes req)+ then req `setHeader` toHeader ("api-nonce", secret)+ & L.over rAuthTypesL (P.filter (/= P.typeOf a))+ else req++-- ** AuthApiKeyApiSignature+data AuthApiKeyApiSignature =+ AuthApiKeyApiSignature Text -- ^ secret+ deriving (P.Eq, P.Show, P.Typeable)++instance AuthMethod AuthApiKeyApiSignature where+ applyAuthMethod _ a@(AuthApiKeyApiSignature secret) req =+ P.pure $+ if (P.typeOf a `P.elem` rAuthTypes req)+ then req `setHeader` toHeader ("api-signature", secret)+ & L.over rAuthTypesL (P.filter (/= P.typeOf a))+ else req++++-- * Custom Mime Types++-- ** MimeJavascript++data MimeJavascript = MimeJavascript deriving (P.Typeable)++-- | @application/javascript@+instance MimeType MimeJavascript where+ mimeType _ = Just $ P.fromString "application/javascript"+-- instance MimeRender MimeJavascript T.Text where mimeRender _ = undefined+-- instance MimeUnrender MimeJavascript T.Text where mimeUnrender _ = undefined++-- ** MimeTextjavascript++data MimeTextjavascript = MimeTextjavascript deriving (P.Typeable)++-- | @text/javascript@+instance MimeType MimeTextjavascript where+ mimeType _ = Just $ P.fromString "text/javascript"+-- instance MimeRender MimeTextjavascript T.Text where mimeRender _ = undefined+-- instance MimeUnrender MimeTextjavascript T.Text where mimeUnrender _ = undefined++-- ** MimeTextxml++data MimeTextxml = MimeTextxml deriving (P.Typeable)++-- | @text/xml@+instance MimeType MimeTextxml where+ mimeType _ = Just $ P.fromString "text/xml"+-- instance MimeRender MimeTextxml T.Text where mimeRender _ = undefined+-- instance MimeUnrender MimeTextxml T.Text where mimeUnrender _ = undefined++
+ lib/BitMEX/Client.hs view
@@ -0,0 +1,218 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section.++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.Client+-}++{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-}+{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-}++module BitMEX.Client where++import BitMEX.Core+import BitMEX.Logging+import BitMEX.MimeTypes++import qualified Control.Exception.Safe as E+import qualified Control.Monad.IO.Class as P+import qualified Control.Monad as P+import qualified Data.Aeson.Types as A+import qualified Data.ByteString.Char8 as BC+import qualified Data.ByteString.Lazy as BL+import qualified Data.ByteString.Lazy.Char8 as BCL+import qualified Data.Proxy as P (Proxy(..))+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Network.HTTP.Client as NH+import qualified Network.HTTP.Client.MultipartFormData as NH+import qualified Network.HTTP.Types as NH+import qualified Web.FormUrlEncoded as WH+import qualified Web.HttpApiData as WH++import Data.Function ((&))+import Data.Monoid ((<>))+import Data.Text (Text)+import GHC.Exts (IsString(..))++-- * Dispatch++-- ** Lbs++-- | send a request returning the raw http response+dispatchLbs+ :: (Produces req accept, MimeType contentType)+ => NH.Manager -- ^ http-client Connection manager+ -> BitMEXConfig -- ^ config+ -> BitMEXRequest req contentType res accept -- ^ request+ -> IO (NH.Response BCL.ByteString) -- ^ response+dispatchLbs manager config request = do+ initReq <- _toInitRequest config request+ dispatchInitUnsafe manager config initReq++-- ** Mime++-- | pair of decoded http body and http response+data MimeResult res =+ MimeResult { mimeResult :: Either MimeError res -- ^ decoded http body+ , mimeResultResponse :: NH.Response BCL.ByteString -- ^ http response+ }+ deriving (Show, Functor, Foldable, Traversable)++-- | pair of unrender/parser error and http response+data MimeError =+ MimeError {+ mimeError :: String -- ^ unrender/parser error+ , mimeErrorResponse :: NH.Response BCL.ByteString -- ^ http response+ } deriving (Eq, Show)++-- | send a request returning the 'MimeResult'+dispatchMime+ :: forall req contentType res accept. (Produces req accept, MimeUnrender accept res, MimeType contentType)+ => NH.Manager -- ^ http-client Connection manager+ -> BitMEXConfig -- ^ config+ -> BitMEXRequest req contentType res accept -- ^ request+ -> IO (MimeResult res) -- ^ response+dispatchMime manager config request = do+ httpResponse <- dispatchLbs manager config request+ let statusCode = NH.statusCode . NH.responseStatus $ httpResponse+ parsedResult <-+ runConfigLogWithExceptions "Client" config $+ do if (statusCode >= 400 && statusCode < 600)+ then do+ let s = "error statusCode: " ++ show statusCode ++ show httpResponse ++ show (NH.responseBody httpResponse)+ _log "Client" levelError (T.pack s)+ pure (Left (MimeError s httpResponse))+ else case mimeUnrender (P.Proxy :: P.Proxy accept) (NH.responseBody httpResponse) of+ Left s -> do+ _log "Client" levelError (T.pack s)+ pure (Left (MimeError s httpResponse))+ Right r -> pure (Right r)+ return (MimeResult parsedResult httpResponse)++-- | like 'dispatchMime', but only returns the decoded http body+dispatchMime'+ :: (Produces req accept, MimeUnrender accept res, MimeType contentType)+ => NH.Manager -- ^ http-client Connection manager+ -> BitMEXConfig -- ^ config+ -> BitMEXRequest req contentType res accept -- ^ request+ -> IO (Either MimeError res) -- ^ response+dispatchMime' manager config request = do+ MimeResult parsedResult _ <- dispatchMime manager config request+ return parsedResult++-- ** Unsafe++-- | like 'dispatchReqLbs', but does not validate the operation is a 'Producer' of the "accept" 'MimeType'. (Useful if the server's response is undocumented)+dispatchLbsUnsafe+ :: (MimeType accept, MimeType contentType)+ => NH.Manager -- ^ http-client Connection manager+ -> BitMEXConfig -- ^ config+ -> BitMEXRequest req contentType res accept -- ^ request+ -> IO (NH.Response BCL.ByteString) -- ^ response+dispatchLbsUnsafe manager config request = do+ initReq <- _toInitRequest config request+ dispatchInitUnsafe manager config initReq++-- | dispatch an InitRequest+dispatchInitUnsafe+ :: NH.Manager -- ^ http-client Connection manager+ -> BitMEXConfig -- ^ config+ -> InitRequest req contentType res accept -- ^ init request+ -> IO (NH.Response BCL.ByteString) -- ^ response+dispatchInitUnsafe manager config (InitRequest req) = do+ runConfigLogWithExceptions src config $+ do _log src levelInfo requestLogMsg+ _log src levelDebug requestDbgLogMsg+ res <- P.liftIO $ NH.httpLbs req manager+ _log src levelInfo (responseLogMsg res)+ _log src levelDebug ((T.pack . show) res)+ return res+ where+ src = "Client"+ endpoint =+ T.pack $+ BC.unpack $+ NH.method req <> " " <> NH.host req <> NH.path req <> NH.queryString req+ requestLogMsg = "REQ:" <> endpoint+ requestDbgLogMsg =+ "Headers=" <> (T.pack . show) (NH.requestHeaders req) <> " Body=" <>+ (case NH.requestBody req of+ NH.RequestBodyLBS xs -> T.decodeUtf8 (BL.toStrict xs)+ _ -> "<RequestBody>")+ responseStatusCode = (T.pack . show) . NH.statusCode . NH.responseStatus+ responseLogMsg res =+ "RES:statusCode=" <> responseStatusCode res <> " (" <> endpoint <> ")"++-- * InitRequest++-- | wraps an http-client 'Request' with request/response type parameters+newtype InitRequest req contentType res accept = InitRequest+ { unInitRequest :: NH.Request+ } deriving (Show)++-- | Build an http-client 'Request' record from the supplied config and request+_toInitRequest+ :: (MimeType accept, MimeType contentType)+ => BitMEXConfig -- ^ config+ -> BitMEXRequest req contentType res accept -- ^ request+ -> IO (InitRequest req contentType res accept) -- ^ initialized request+_toInitRequest config req0 = do+ runConfigLogWithExceptions "Client" config $ do+ parsedReq <- P.liftIO $ NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (rUrlPath req0))+ req1 <- P.liftIO $ _applyAuthMethods req0 config+ P.when+ (configValidateAuthMethods config && (not . null . rAuthTypes) req1)+ (E.throw $ AuthMethodException $ "AuthMethod not configured: " <> (show . head . rAuthTypes) req1)+ let req2 = req1 & _setContentTypeHeader & _setAcceptHeader+ reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (rParams req2)+ reqQuery = NH.renderQuery True (paramsQuery (rParams req2))+ pReq = parsedReq { NH.method = (rMethod req2)+ , NH.requestHeaders = reqHeaders+ , NH.queryString = reqQuery+ }+ outReq <- case paramsBody (rParams req2) of+ ParamBodyNone -> pure (pReq { NH.requestBody = mempty })+ ParamBodyB bs -> pure (pReq { NH.requestBody = NH.RequestBodyBS bs })+ ParamBodyBL bl -> pure (pReq { NH.requestBody = NH.RequestBodyLBS bl })+ ParamBodyFormUrlEncoded form -> pure (pReq { NH.requestBody = NH.RequestBodyLBS (WH.urlEncodeForm form) })+ ParamBodyMultipartFormData parts -> NH.formDataBody parts pReq++ pure (InitRequest outReq)++-- | modify the underlying Request+modifyInitRequest :: InitRequest req contentType res accept -> (NH.Request -> NH.Request) -> InitRequest req contentType res accept+modifyInitRequest (InitRequest req) f = InitRequest (f req)++-- | modify the underlying Request (monadic)+modifyInitRequestM :: Monad m => InitRequest req contentType res accept -> (NH.Request -> m NH.Request) -> m (InitRequest req contentType res accept)+modifyInitRequestM (InitRequest req) f = fmap InitRequest (f req)++-- ** Logging++-- | Run a block using the configured logger instance+runConfigLog+ :: P.MonadIO m+ => BitMEXConfig -> LogExec m+runConfigLog config = configLogExecWithContext config (configLogContext config)++-- | Run a block using the configured logger instance (logs exceptions)+runConfigLogWithExceptions+ :: (E.MonadCatch m, P.MonadIO m)+ => T.Text -> BitMEXConfig -> LogExec m+runConfigLogWithExceptions src config = runConfigLog config . logExceptions src
+ lib/BitMEX/Core.hs view
@@ -0,0 +1,545 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. ++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.Core+-}++{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TupleSections #-}+{-# LANGUAGE TypeFamilies #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds #-}++module BitMEX.Core where++import BitMEX.MimeTypes+import BitMEX.Logging++import qualified Control.Arrow as P (left)+import qualified Control.DeepSeq as NF+import qualified Control.Exception.Safe as E+import qualified Data.Aeson as A+import qualified Data.ByteString as B+import qualified Data.ByteString.Base64.Lazy as BL64+import qualified Data.ByteString.Builder as BB+import qualified Data.ByteString.Char8 as BC+import qualified Data.ByteString.Lazy as BL+import qualified Data.ByteString.Lazy.Char8 as BCL+import qualified Data.CaseInsensitive as CI+import qualified Data.Data as P (Data, Typeable, TypeRep, typeRep)+import qualified Data.Foldable as P+import qualified Data.Ix as P+import qualified Data.Maybe as P+import qualified Data.Proxy as P (Proxy(..))+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Data.Time as TI+import qualified Data.Time.ISO8601 as TI+import qualified GHC.Base as P (Alternative)+import qualified Lens.Micro as L+import qualified Network.HTTP.Client.MultipartFormData as NH+import qualified Network.HTTP.Types as NH+import qualified Prelude as P+import qualified Web.FormUrlEncoded as WH+import qualified Web.HttpApiData as WH+import qualified Text.Printf as T++import Control.Applicative ((<|>))+import Control.Applicative (Alternative)+import Data.Function ((&))+import Data.Foldable(foldlM)+import Data.Monoid ((<>))+import Data.Text (Text)+import Prelude (($), (.), (<$>), (<*>), Maybe(..), Bool(..), Char, String, fmap, mempty, pure, return, show, IO, Monad, Functor)++-- * BitMEXConfig++-- | +data BitMEXConfig = BitMEXConfig+ { configHost :: BCL.ByteString -- ^ host supplied in the Request+ , configUserAgent :: Text -- ^ user-agent supplied in the Request+ , configLogExecWithContext :: LogExecWithContext -- ^ Run a block using a Logger instance+ , configLogContext :: LogContext -- ^ Configures the logger+ , configAuthMethods :: [AnyAuthMethod] -- ^ List of configured auth methods+ , configValidateAuthMethods :: Bool -- ^ throw exceptions if auth methods are not configured+ }++-- | display the config+instance P.Show BitMEXConfig where+ show c =+ T.printf+ "{ configHost = %v, configUserAgent = %v, ..}"+ (show (configHost c))+ (show (configUserAgent c))++-- | constructs a default BitMEXConfig+--+-- configHost:+--+-- @https://localhost/api/v1@+--+-- configUserAgent:+--+-- @"swagger-haskell-http-client/1.0.0"@+--+newConfig :: IO BitMEXConfig+newConfig = do+ logCxt <- initLogContext+ return $ BitMEXConfig+ { configHost = "https://localhost/api/v1"+ , configUserAgent = "swagger-haskell-http-client/1.0.0"+ , configLogExecWithContext = runDefaultLogExecWithContext+ , configLogContext = logCxt+ , configAuthMethods = []+ , configValidateAuthMethods = True+ } ++-- | updates config use AuthMethod on matching requests+addAuthMethod :: AuthMethod auth => BitMEXConfig -> auth -> BitMEXConfig+addAuthMethod config@BitMEXConfig {configAuthMethods = as} a =+ config { configAuthMethods = AnyAuthMethod a : as}++-- | updates the config to use stdout logging+withStdoutLogging :: BitMEXConfig -> IO BitMEXConfig+withStdoutLogging p = do+ logCxt <- stdoutLoggingContext (configLogContext p)+ return $ p { configLogExecWithContext = stdoutLoggingExec, configLogContext = logCxt }++-- | updates the config to use stderr logging+withStderrLogging :: BitMEXConfig -> IO BitMEXConfig+withStderrLogging p = do+ logCxt <- stderrLoggingContext (configLogContext p)+ return $ p { configLogExecWithContext = stderrLoggingExec, configLogContext = logCxt }++-- | updates the config to disable logging+withNoLogging :: BitMEXConfig -> BitMEXConfig+withNoLogging p = p { configLogExecWithContext = runNullLogExec}+ +-- * BitMEXRequest++-- | Represents a request.+--+-- Type Variables:+--+-- * req - request operation+-- * contentType - 'MimeType' associated with request body+-- * res - response model+-- * accept - 'MimeType' associated with response body+data BitMEXRequest req contentType res accept = BitMEXRequest+ { rMethod :: NH.Method -- ^ Method of BitMEXRequest+ , rUrlPath :: [BCL.ByteString] -- ^ Endpoint of BitMEXRequest+ , rParams :: Params -- ^ params of BitMEXRequest+ , rAuthTypes :: [P.TypeRep] -- ^ types of auth methods+ }+ deriving (P.Show)++-- | 'rMethod' Lens+rMethodL :: Lens_' (BitMEXRequest req contentType res accept) NH.Method+rMethodL f BitMEXRequest{..} = (\rMethod -> BitMEXRequest { rMethod, ..} ) <$> f rMethod+{-# INLINE rMethodL #-}++-- | 'rUrlPath' Lens+rUrlPathL :: Lens_' (BitMEXRequest req contentType res accept) [BCL.ByteString]+rUrlPathL f BitMEXRequest{..} = (\rUrlPath -> BitMEXRequest { rUrlPath, ..} ) <$> f rUrlPath+{-# INLINE rUrlPathL #-}++-- | 'rParams' Lens+rParamsL :: Lens_' (BitMEXRequest req contentType res accept) Params+rParamsL f BitMEXRequest{..} = (\rParams -> BitMEXRequest { rParams, ..} ) <$> f rParams+{-# INLINE rParamsL #-}++-- | 'rParams' Lens+rAuthTypesL :: Lens_' (BitMEXRequest req contentType res accept) [P.TypeRep]+rAuthTypesL f BitMEXRequest{..} = (\rAuthTypes -> BitMEXRequest { rAuthTypes, ..} ) <$> f rAuthTypes+{-# INLINE rAuthTypesL #-}++-- * HasBodyParam++-- | Designates the body parameter of a request+class HasBodyParam req param where+ setBodyParam :: forall contentType res accept. (Consumes req contentType, MimeRender contentType param) => BitMEXRequest req contentType res accept -> param -> BitMEXRequest req contentType res accept+ setBodyParam req xs =+ req `_setBodyLBS` mimeRender (P.Proxy :: P.Proxy contentType) xs & _setContentTypeHeader++-- * HasOptionalParam++-- | Designates the optional parameters of a request+class HasOptionalParam req param where+ {-# MINIMAL applyOptionalParam | (-&-) #-}++ -- | Apply an optional parameter to a request+ applyOptionalParam :: BitMEXRequest req contentType res accept -> param -> BitMEXRequest req contentType res accept+ applyOptionalParam = (-&-)+ {-# INLINE applyOptionalParam #-}++ -- | infix operator \/ alias for 'addOptionalParam'+ (-&-) :: BitMEXRequest req contentType res accept -> param -> BitMEXRequest req contentType res accept+ (-&-) = applyOptionalParam+ {-# INLINE (-&-) #-}++infixl 2 -&-++-- | Request Params+data Params = Params+ { paramsQuery :: NH.Query+ , paramsHeaders :: NH.RequestHeaders+ , paramsBody :: ParamBody+ }+ deriving (P.Show)++-- | 'paramsQuery' Lens+paramsQueryL :: Lens_' Params NH.Query+paramsQueryL f Params{..} = (\paramsQuery -> Params { paramsQuery, ..} ) <$> f paramsQuery+{-# INLINE paramsQueryL #-}++-- | 'paramsHeaders' Lens+paramsHeadersL :: Lens_' Params NH.RequestHeaders+paramsHeadersL f Params{..} = (\paramsHeaders -> Params { paramsHeaders, ..} ) <$> f paramsHeaders+{-# INLINE paramsHeadersL #-}++-- | 'paramsBody' Lens+paramsBodyL :: Lens_' Params ParamBody+paramsBodyL f Params{..} = (\paramsBody -> Params { paramsBody, ..} ) <$> f paramsBody+{-# INLINE paramsBodyL #-}++-- | Request Body+data ParamBody+ = ParamBodyNone+ | ParamBodyB B.ByteString+ | ParamBodyBL BL.ByteString+ | ParamBodyFormUrlEncoded WH.Form+ | ParamBodyMultipartFormData [NH.Part]+ deriving (P.Show)++-- ** BitMEXRequest Utils++_mkRequest :: NH.Method -- ^ Method + -> [BCL.ByteString] -- ^ Endpoint+ -> BitMEXRequest req contentType res accept -- ^ req: Request Type, res: Response Type+_mkRequest m u = BitMEXRequest m u _mkParams []++_mkParams :: Params+_mkParams = Params [] [] ParamBodyNone++setHeader :: BitMEXRequest req contentType res accept -> [NH.Header] -> BitMEXRequest req contentType res accept+setHeader req header =+ req `removeHeader` P.fmap P.fst header &+ L.over (rParamsL . paramsHeadersL) (header P.++)++removeHeader :: BitMEXRequest req contentType res accept -> [NH.HeaderName] -> BitMEXRequest req contentType res accept+removeHeader req header =+ req &+ L.over+ (rParamsL . paramsHeadersL)+ (P.filter (\h -> cifst h `P.notElem` P.fmap CI.mk header))+ where+ cifst = CI.mk . P.fst+++_setContentTypeHeader :: forall req contentType res accept. MimeType contentType => BitMEXRequest req contentType res accept -> BitMEXRequest req contentType res accept+_setContentTypeHeader req =+ case mimeType (P.Proxy :: P.Proxy contentType) of + Just m -> req `setHeader` [("content-type", BC.pack $ P.show m)]+ Nothing -> req `removeHeader` ["content-type"]++_setAcceptHeader :: forall req contentType res accept. MimeType accept => BitMEXRequest req contentType res accept -> BitMEXRequest req contentType res accept+_setAcceptHeader req =+ case mimeType (P.Proxy :: P.Proxy accept) of + Just m -> req `setHeader` [("accept", BC.pack $ P.show m)]+ Nothing -> req `removeHeader` ["accept"]++setQuery :: BitMEXRequest req contentType res accept -> [NH.QueryItem] -> BitMEXRequest req contentType res accept+setQuery req query = + req &+ L.over+ (rParamsL . paramsQueryL)+ ((query P.++) . P.filter (\q -> cifst q `P.notElem` P.fmap cifst query))+ where+ cifst = CI.mk . P.fst++addForm :: BitMEXRequest req contentType res accept -> WH.Form -> BitMEXRequest req contentType res accept+addForm req newform = + let form = case paramsBody (rParams req) of+ ParamBodyFormUrlEncoded _form -> _form+ _ -> mempty+ in req & L.set (rParamsL . paramsBodyL) (ParamBodyFormUrlEncoded (newform <> form))++_addMultiFormPart :: BitMEXRequest req contentType res accept -> NH.Part -> BitMEXRequest req contentType res accept+_addMultiFormPart req newpart = + let parts = case paramsBody (rParams req) of+ ParamBodyMultipartFormData _parts -> _parts+ _ -> []+ in req & L.set (rParamsL . paramsBodyL) (ParamBodyMultipartFormData (newpart : parts))++_setBodyBS :: BitMEXRequest req contentType res accept -> B.ByteString -> BitMEXRequest req contentType res accept+_setBodyBS req body = + req & L.set (rParamsL . paramsBodyL) (ParamBodyB body)++_setBodyLBS :: BitMEXRequest req contentType res accept -> BL.ByteString -> BitMEXRequest req contentType res accept+_setBodyLBS req body = + req & L.set (rParamsL . paramsBodyL) (ParamBodyBL body)++_hasAuthType :: AuthMethod authMethod => BitMEXRequest req contentType res accept -> P.Proxy authMethod -> BitMEXRequest req contentType res accept+_hasAuthType req proxy =+ req & L.over rAuthTypesL (P.typeRep proxy :)++-- ** Params Utils++toPath+ :: WH.ToHttpApiData a+ => a -> BCL.ByteString+toPath = BB.toLazyByteString . WH.toEncodedUrlPiece++toHeader :: WH.ToHttpApiData a => (NH.HeaderName, a) -> [NH.Header]+toHeader x = [fmap WH.toHeader x]++toForm :: WH.ToHttpApiData v => (BC.ByteString, v) -> WH.Form+toForm (k,v) = WH.toForm [(BC.unpack k,v)]++toQuery :: WH.ToHttpApiData a => (BC.ByteString, Maybe a) -> [NH.QueryItem]+toQuery x = [(fmap . fmap) toQueryParam x]+ where toQueryParam = T.encodeUtf8 . WH.toQueryParam++-- *** Swagger `CollectionFormat` Utils++-- | Determines the format of the array if type array is used.+data CollectionFormat+ = CommaSeparated -- ^ CSV format for multiple parameters.+ | SpaceSeparated -- ^ Also called "SSV"+ | TabSeparated -- ^ Also called "TSV"+ | PipeSeparated -- ^ `value1|value2|value2`+ | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. This is valid only for parameters in "query" ('NH.Query') or "formData" ('WH.Form')++toHeaderColl :: WH.ToHttpApiData a => CollectionFormat -> (NH.HeaderName, [a]) -> [NH.Header]+toHeaderColl c xs = _toColl c toHeader xs++toFormColl :: WH.ToHttpApiData v => CollectionFormat -> (BC.ByteString, [v]) -> WH.Form+toFormColl c xs = WH.toForm $ fmap unpack $ _toColl c toHeader $ pack xs+ where+ pack (k,v) = (CI.mk k, v)+ unpack (k,v) = (BC.unpack (CI.original k), BC.unpack v)++toQueryColl :: WH.ToHttpApiData a => CollectionFormat -> (BC.ByteString, Maybe [a]) -> NH.Query+toQueryColl c xs = _toCollA c toQuery xs++_toColl :: P.Traversable f => CollectionFormat -> (f a -> [(b, BC.ByteString)]) -> f [a] -> [(b, BC.ByteString)]+_toColl c encode xs = fmap (fmap P.fromJust) (_toCollA' c fencode BC.singleton (fmap Just xs))+ where fencode = fmap (fmap Just) . encode . fmap P.fromJust+ {-# INLINE fencode #-}++_toCollA :: (P.Traversable f, P.Traversable t, P.Alternative t) => CollectionFormat -> (f (t a) -> [(b, t BC.ByteString)]) -> f (t [a]) -> [(b, t BC.ByteString)]+_toCollA c encode xs = _toCollA' c encode BC.singleton xs++_toCollA' :: (P.Monoid c, P.Traversable f, P.Traversable t, P.Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)]+_toCollA' c encode one xs = case c of+ CommaSeparated -> go (one ',')+ SpaceSeparated -> go (one ' ')+ TabSeparated -> go (one '\t')+ PipeSeparated -> go (one '|')+ MultiParamArray -> expandList+ where+ go sep =+ [P.foldl1 (\(sk, sv) (_, v) -> (sk, (combine sep <$> sv <*> v) <|> sv <|> v)) expandList]+ combine sep x y = x <> sep <> y+ expandList = (P.concatMap encode . (P.traverse . P.traverse) P.toList) xs+ {-# INLINE go #-}+ {-# INLINE expandList #-}+ {-# INLINE combine #-}+ +-- * AuthMethods++-- | Provides a method to apply auth methods to requests+class P.Typeable a =>+ AuthMethod a where+ applyAuthMethod+ :: BitMEXConfig+ -> a+ -> BitMEXRequest req contentType res accept+ -> IO (BitMEXRequest req contentType res accept)++-- | An existential wrapper for any AuthMethod+data AnyAuthMethod = forall a. AuthMethod a => AnyAuthMethod a deriving (P.Typeable)++instance AuthMethod AnyAuthMethod where applyAuthMethod config (AnyAuthMethod a) req = applyAuthMethod config a req++-- | indicates exceptions related to AuthMethods+data AuthMethodException = AuthMethodException String deriving (P.Show, P.Typeable)++instance E.Exception AuthMethodException++-- | apply all matching AuthMethods in config to request+_applyAuthMethods+ :: BitMEXRequest req contentType res accept+ -> BitMEXConfig+ -> IO (BitMEXRequest req contentType res accept)+_applyAuthMethods req config@(BitMEXConfig {configAuthMethods = as}) =+ foldlM go req as+ where+ go r (AnyAuthMethod a) = applyAuthMethod config a r+ +-- * Utils++-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)+_omitNulls :: [(Text, A.Value)] -> A.Value+_omitNulls = A.object . P.filter notNull+ where+ notNull (_, A.Null) = False+ notNull _ = True++-- | Encodes fields using WH.toQueryParam+_toFormItem :: (WH.ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text])+_toFormItem name x = (name,) . (:[]) . WH.toQueryParam <$> x++-- | Collapse (Just "") to Nothing+_emptyToNothing :: Maybe String -> Maybe String+_emptyToNothing (Just "") = Nothing+_emptyToNothing x = x+{-# INLINE _emptyToNothing #-}++-- | Collapse (Just mempty) to Nothing+_memptyToNothing :: (P.Monoid a, P.Eq a) => Maybe a -> Maybe a+_memptyToNothing (Just x) | x P.== P.mempty = Nothing+_memptyToNothing x = x+{-# INLINE _memptyToNothing #-}++-- * DateTime Formatting++newtype DateTime = DateTime { unDateTime :: TI.UTCTime }+ deriving (P.Eq,P.Data,P.Ord,P.Typeable,NF.NFData,TI.ParseTime,TI.FormatTime)+instance A.FromJSON DateTime where+ parseJSON = A.withText "DateTime" (_readDateTime . T.unpack)+instance A.ToJSON DateTime where+ toJSON (DateTime t) = A.toJSON (_showDateTime t)+instance WH.FromHttpApiData DateTime where+ parseUrlPiece = P.left T.pack . _readDateTime . T.unpack+instance WH.ToHttpApiData DateTime where+ toUrlPiece (DateTime t) = T.pack (_showDateTime t)+instance P.Show DateTime where+ show (DateTime t) = _showDateTime t+instance MimeRender MimeMultipartFormData DateTime where+ mimeRender _ = mimeRenderDefaultMultipartFormData++-- | @_parseISO8601@+_readDateTime :: (TI.ParseTime t, Monad m, Alternative m) => String -> m t+_readDateTime =+ _parseISO8601+{-# INLINE _readDateTime #-}++-- | @TI.formatISO8601Millis@+_showDateTime :: (t ~ TI.UTCTime, TI.FormatTime t) => t -> String+_showDateTime =+ TI.formatISO8601Millis+{-# INLINE _showDateTime #-}++-- | parse an ISO8601 date-time string+_parseISO8601 :: (TI.ParseTime t, Monad m, Alternative m) => String -> m t+_parseISO8601 t =+ P.asum $+ P.flip (TI.parseTimeM True TI.defaultTimeLocale) t <$>+ ["%FT%T%QZ", "%FT%T%Q%z", "%FT%T%Q%Z"]+{-# INLINE _parseISO8601 #-}++-- * Date Formatting++newtype Date = Date { unDate :: TI.Day }+ deriving (P.Enum,P.Eq,P.Data,P.Ord,P.Ix,NF.NFData,TI.ParseTime,TI.FormatTime)+instance A.FromJSON Date where+ parseJSON = A.withText "Date" (_readDate . T.unpack)+instance A.ToJSON Date where+ toJSON (Date t) = A.toJSON (_showDate t)+instance WH.FromHttpApiData Date where+ parseUrlPiece = P.left T.pack . _readDate . T.unpack+instance WH.ToHttpApiData Date where+ toUrlPiece (Date t) = T.pack (_showDate t)+instance P.Show Date where+ show (Date t) = _showDate t+instance MimeRender MimeMultipartFormData Date where+ mimeRender _ = mimeRenderDefaultMultipartFormData++-- | @TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"@+_readDate :: (TI.ParseTime t, Monad m) => String -> m t+_readDate =+ TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"+{-# INLINE _readDate #-}++-- | @TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"@+_showDate :: TI.FormatTime t => t -> String+_showDate =+ TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"+{-# INLINE _showDate #-}++-- * Byte/Binary Formatting++ +-- | base64 encoded characters+newtype ByteArray = ByteArray { unByteArray :: BL.ByteString }+ deriving (P.Eq,P.Data,P.Ord,P.Typeable,NF.NFData)++instance A.FromJSON ByteArray where+ parseJSON = A.withText "ByteArray" _readByteArray+instance A.ToJSON ByteArray where+ toJSON = A.toJSON . _showByteArray+instance WH.FromHttpApiData ByteArray where+ parseUrlPiece = P.left T.pack . _readByteArray+instance WH.ToHttpApiData ByteArray where+ toUrlPiece = _showByteArray+instance P.Show ByteArray where+ show = T.unpack . _showByteArray+instance MimeRender MimeMultipartFormData ByteArray where+ mimeRender _ = mimeRenderDefaultMultipartFormData++-- | read base64 encoded characters+_readByteArray :: Monad m => Text -> m ByteArray+_readByteArray = P.either P.fail (pure . ByteArray) . BL64.decode . BL.fromStrict . T.encodeUtf8+{-# INLINE _readByteArray #-}++-- | show base64 encoded characters+_showByteArray :: ByteArray -> Text+_showByteArray = T.decodeUtf8 . BL.toStrict . BL64.encode . unByteArray+{-# INLINE _showByteArray #-}++-- | any sequence of octets+newtype Binary = Binary { unBinary :: BL.ByteString }+ deriving (P.Eq,P.Data,P.Ord,P.Typeable,NF.NFData)++instance A.FromJSON Binary where+ parseJSON = A.withText "Binary" _readBinaryBase64+instance A.ToJSON Binary where+ toJSON = A.toJSON . _showBinaryBase64+instance WH.FromHttpApiData Binary where+ parseUrlPiece = P.left T.pack . _readBinaryBase64+instance WH.ToHttpApiData Binary where+ toUrlPiece = _showBinaryBase64+instance P.Show Binary where+ show = T.unpack . _showBinaryBase64+instance MimeRender MimeMultipartFormData Binary where+ mimeRender _ = unBinary++_readBinaryBase64 :: Monad m => Text -> m Binary+_readBinaryBase64 = P.either P.fail (pure . Binary) . BL64.decode . BL.fromStrict . T.encodeUtf8+{-# INLINE _readBinaryBase64 #-}++_showBinaryBase64 :: Binary -> Text+_showBinaryBase64 = T.decodeUtf8 . BL.toStrict . BL64.encode . unBinary+{-# INLINE _showBinaryBase64 #-}++-- * Lens Type Aliases++type Lens_' s a = Lens_ s s a a+type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t
+ lib/BitMEX/Logging.hs view
@@ -0,0 +1,118 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section.++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.Logging+Katip Logging functions+-}++{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE ScopedTypeVariables #-}++module BitMEX.Logging where++import qualified Control.Exception.Safe as E+import qualified Control.Monad.IO.Class as P+import qualified Control.Monad.Trans.Reader as P+import qualified Data.Text as T+import qualified Lens.Micro as L+import qualified System.IO as IO++import Data.Text (Text)+import GHC.Exts (IsString (..))++import qualified Katip as LG++-- * Type Aliases (for compatibility)++-- | Runs a Katip logging block with the Log environment+type LogExecWithContext = forall m. P.MonadIO m =>+ LogContext -> LogExec m++-- | A Katip logging block+type LogExec m = forall a. LG.KatipT m a -> m a++-- | A Katip Log environment+type LogContext = LG.LogEnv++-- | A Katip Log severity+type LogLevel = LG.Severity++-- * default logger++-- | the default log environment+initLogContext :: IO LogContext+initLogContext = LG.initLogEnv "BitMEX" "dev"++-- | Runs a Katip logging block with the Log environment+runDefaultLogExecWithContext :: LogExecWithContext+runDefaultLogExecWithContext = LG.runKatipT++-- * stdout logger++-- | Runs a Katip logging block with the Log environment+stdoutLoggingExec :: LogExecWithContext+stdoutLoggingExec = runDefaultLogExecWithContext++-- | A Katip Log environment which targets stdout+stdoutLoggingContext :: LogContext -> IO LogContext+stdoutLoggingContext cxt = do+ handleScribe <- LG.mkHandleScribe LG.ColorIfTerminal IO.stdout LG.InfoS LG.V2+ LG.registerScribe "stdout" handleScribe LG.defaultScribeSettings cxt++-- * stderr logger++-- | Runs a Katip logging block with the Log environment+stderrLoggingExec :: LogExecWithContext+stderrLoggingExec = runDefaultLogExecWithContext++-- | A Katip Log environment which targets stderr+stderrLoggingContext :: LogContext -> IO LogContext+stderrLoggingContext cxt = do+ handleScribe <- LG.mkHandleScribe LG.ColorIfTerminal IO.stderr LG.InfoS LG.V2+ LG.registerScribe "stderr" handleScribe LG.defaultScribeSettings cxt++-- * Null logger++-- | Disables Katip logging+runNullLogExec :: LogExecWithContext+runNullLogExec le (LG.KatipT f) = P.runReaderT f (L.set LG.logEnvScribes mempty le)++-- * Log Msg++-- | Log a katip message+_log :: (Applicative m, LG.Katip m) => Text -> LogLevel -> Text -> m ()+_log src level msg = do+ LG.logMsg (fromString $ T.unpack src) level (LG.logStr msg)++-- * Log Exceptions++-- | re-throws exceptions after logging them+logExceptions+ :: (LG.Katip m, E.MonadCatch m, Applicative m)+ => Text -> m a -> m a+logExceptions src =+ E.handle+ (\(e :: E.SomeException) -> do+ _log src LG.ErrorS ((T.pack . show) e)+ E.throw e)++-- * Log Level++levelInfo :: LogLevel+levelInfo = LG.InfoS++levelError :: LogLevel+levelError = LG.ErrorS++levelDebug :: LogLevel+levelDebug = LG.DebugS
+ lib/BitMEX/MimeTypes.hs view
@@ -0,0 +1,202 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. ++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.MimeTypes+-}++{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-}++module BitMEX.MimeTypes where++import qualified Control.Arrow as P (left)+import qualified Data.Aeson as A+import qualified Data.ByteString as B+import qualified Data.ByteString.Builder as BB+import qualified Data.ByteString.Char8 as BC+import qualified Data.ByteString.Lazy as BL+import qualified Data.ByteString.Lazy.Char8 as BCL+import qualified Data.Data as P (Typeable)+import qualified Data.Proxy as P (Proxy(..))+import qualified Data.String as P+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Network.HTTP.Media as ME+import qualified Web.FormUrlEncoded as WH+import qualified Web.HttpApiData as WH++import Prelude (($), (.),(<$>),(<*>),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty)+import qualified Prelude as P++-- * ContentType MimeType++data ContentType a = MimeType a => ContentType { unContentType :: a }++-- * Accept MimeType++data Accept a = MimeType a => Accept { unAccept :: a }++-- * Consumes Class++class MimeType mtype => Consumes req mtype where++-- * Produces Class++class MimeType mtype => Produces req mtype where++-- * Default Mime Types++data MimeJSON = MimeJSON deriving (P.Typeable)+data MimeXML = MimeXML deriving (P.Typeable)+data MimePlainText = MimePlainText deriving (P.Typeable)+data MimeFormUrlEncoded = MimeFormUrlEncoded deriving (P.Typeable)+data MimeMultipartFormData = MimeMultipartFormData deriving (P.Typeable)+data MimeOctetStream = MimeOctetStream deriving (P.Typeable)+data MimeNoContent = MimeNoContent deriving (P.Typeable)+data MimeAny = MimeAny deriving (P.Typeable)++-- | A type for responses without content-body.+data NoContent = NoContent+ deriving (P.Show, P.Eq, P.Typeable)+++-- * MimeType Class++class P.Typeable mtype => MimeType mtype where+ {-# MINIMAL mimeType | mimeTypes #-}++ mimeTypes :: P.Proxy mtype -> [ME.MediaType]+ mimeTypes p =+ case mimeType p of+ Just x -> [x]+ Nothing -> []++ mimeType :: P.Proxy mtype -> Maybe ME.MediaType+ mimeType p =+ case mimeTypes p of+ [] -> Nothing+ (x:_) -> Just x++ mimeType' :: mtype -> Maybe ME.MediaType+ mimeType' _ = mimeType (P.Proxy :: P.Proxy mtype)+ mimeTypes' :: mtype -> [ME.MediaType]+ mimeTypes' _ = mimeTypes (P.Proxy :: P.Proxy mtype)++-- Default MimeType Instances++-- | @application/json; charset=utf-8@+instance MimeType MimeJSON where+ mimeType _ = Just $ P.fromString "application/json"+-- | @application/xml; charset=utf-8@+instance MimeType MimeXML where+ mimeType _ = Just $ P.fromString "application/xml"+-- | @application/x-www-form-urlencoded@+instance MimeType MimeFormUrlEncoded where+ mimeType _ = Just $ P.fromString "application/x-www-form-urlencoded"+-- | @multipart/form-data@+instance MimeType MimeMultipartFormData where+ mimeType _ = Just $ P.fromString "multipart/form-data"+-- | @text/plain; charset=utf-8@+instance MimeType MimePlainText where+ mimeType _ = Just $ P.fromString "text/plain"+-- | @application/octet-stream@+instance MimeType MimeOctetStream where+ mimeType _ = Just $ P.fromString "application/octet-stream"+-- | @"*/*"@+instance MimeType MimeAny where+ mimeType _ = Just $ P.fromString "*/*"+instance MimeType MimeNoContent where+ mimeType _ = Nothing++-- * MimeRender Class++class MimeType mtype => MimeRender mtype x where+ mimeRender :: P.Proxy mtype -> x -> BL.ByteString+ mimeRender' :: mtype -> x -> BL.ByteString+ mimeRender' _ x = mimeRender (P.Proxy :: P.Proxy mtype) x+++mimeRenderDefaultMultipartFormData :: WH.ToHttpApiData a => a -> BL.ByteString+mimeRenderDefaultMultipartFormData = BL.fromStrict . T.encodeUtf8 . WH.toQueryParam++-- Default MimeRender Instances++-- | `A.encode`+instance A.ToJSON a => MimeRender MimeJSON a where mimeRender _ = A.encode+-- | @WH.urlEncodeAsForm@+instance WH.ToForm a => MimeRender MimeFormUrlEncoded a where mimeRender _ = WH.urlEncodeAsForm++-- | @P.id@+instance MimeRender MimePlainText BL.ByteString where mimeRender _ = P.id+-- | @BL.fromStrict . T.encodeUtf8@+instance MimeRender MimePlainText T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8+-- | @BCL.pack@+instance MimeRender MimePlainText String where mimeRender _ = BCL.pack++-- | @P.id@+instance MimeRender MimeOctetStream BL.ByteString where mimeRender _ = P.id+-- | @BL.fromStrict . T.encodeUtf8@+instance MimeRender MimeOctetStream T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8+-- | @BCL.pack@+instance MimeRender MimeOctetStream String where mimeRender _ = BCL.pack++instance MimeRender MimeMultipartFormData BL.ByteString where mimeRender _ = P.id++instance MimeRender MimeMultipartFormData Bool where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData Char where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData Double where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData Float where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData Int where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData Integer where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData String where mimeRender _ = mimeRenderDefaultMultipartFormData+instance MimeRender MimeMultipartFormData T.Text where mimeRender _ = mimeRenderDefaultMultipartFormData++-- | @P.Right . P.const NoContent@+instance MimeRender MimeNoContent NoContent where mimeRender _ = P.const BCL.empty+++-- * MimeUnrender Class++class MimeType mtype => MimeUnrender mtype o where+ mimeUnrender :: P.Proxy mtype -> BL.ByteString -> P.Either String o+ mimeUnrender' :: mtype -> BL.ByteString -> P.Either String o+ mimeUnrender' _ x = mimeUnrender (P.Proxy :: P.Proxy mtype) x++-- Default MimeUnrender Instances++-- | @A.eitherDecode@+instance A.FromJSON a => MimeUnrender MimeJSON a where mimeUnrender _ = A.eitherDecode+-- | @P.left T.unpack . WH.urlDecodeAsForm@+instance WH.FromForm a => MimeUnrender MimeFormUrlEncoded a where mimeUnrender _ = P.left T.unpack . WH.urlDecodeAsForm+-- | @P.Right . P.id@++instance MimeUnrender MimePlainText BL.ByteString where mimeUnrender _ = P.Right . P.id+-- | @P.left P.show . TL.decodeUtf8'@+instance MimeUnrender MimePlainText T.Text where mimeUnrender _ = P.left P.show . T.decodeUtf8' . BL.toStrict+-- | @P.Right . BCL.unpack@+instance MimeUnrender MimePlainText String where mimeUnrender _ = P.Right . BCL.unpack++-- | @P.Right . P.id@+instance MimeUnrender MimeOctetStream BL.ByteString where mimeUnrender _ = P.Right . P.id+-- | @P.left P.show . T.decodeUtf8' . BL.toStrict@+instance MimeUnrender MimeOctetStream T.Text where mimeUnrender _ = P.left P.show . T.decodeUtf8' . BL.toStrict+-- | @P.Right . BCL.unpack@+instance MimeUnrender MimeOctetStream String where mimeUnrender _ = P.Right . BCL.unpack++-- | @P.Right . P.const NoContent@+instance MimeUnrender MimeNoContent NoContent where mimeUnrender _ = P.Right . P.const NoContent
+ lib/BitMEX/Model.hs view
@@ -0,0 +1,3213 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. ++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.Model+-}++{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TupleSections #-}+{-# LANGUAGE TypeFamilies #-}+{-# OPTIONS_GHC -fno-warn-unused-matches -fno-warn-unused-binds -fno-warn-unused-imports #-}++module BitMEX.Model where++import BitMEX.Core+import BitMEX.MimeTypes++import Data.Aeson ((.:),(.:!),(.:?),(.=))++import qualified Control.Arrow as P (left)+import qualified Data.Aeson as A+import qualified Data.ByteString as B+import qualified Data.ByteString.Lazy as BL+import qualified Data.Data as P (Data, Typeable)+import qualified Data.Foldable as P+import qualified Data.HashMap.Lazy as HM+import qualified Data.Map as Map+import qualified Data.Maybe as P+import qualified Data.Set as Set+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Data.Time as TI+import qualified Web.FormUrlEncoded as WH+import qualified Web.HttpApiData as WH++import Control.Applicative ((<|>))+import Control.Applicative (Alternative)+import Data.Text (Text)+import Prelude (($), (.),(<$>),(<*>),(>>=),(=<<),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)++import qualified Prelude as P++++-- * Models+++-- ** APIKey+-- | APIKey+-- Persistent API Keys for Developers+data APIKey = APIKey+ { aPIKeyId :: !(Text) -- ^ /Required/ "id"+ , aPIKeySecret :: !(Text) -- ^ /Required/ "secret"+ , aPIKeyName :: !(Text) -- ^ /Required/ "name"+ , aPIKeyNonce :: !(Double) -- ^ /Required/ "nonce"+ , aPIKeyCidr :: !(Maybe Text) -- ^ "cidr"+ , aPIKeyPermissions :: !(Maybe [XAny]) -- ^ "permissions"+ , aPIKeyEnabled :: !(Maybe Bool) -- ^ "enabled"+ , aPIKeyUserId :: !(Double) -- ^ /Required/ "userId"+ , aPIKeyCreated :: !(Maybe DateTime) -- ^ "created"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON APIKey+instance A.FromJSON APIKey where+ parseJSON = A.withObject "APIKey" $ \o ->+ APIKey+ <$> (o .: "id")+ <*> (o .: "secret")+ <*> (o .: "name")+ <*> (o .: "nonce")+ <*> (o .:? "cidr")+ <*> (o .:? "permissions")+ <*> (o .:? "enabled")+ <*> (o .: "userId")+ <*> (o .:? "created")++-- | ToJSON APIKey+instance A.ToJSON APIKey where+ toJSON APIKey {..} =+ _omitNulls+ [ "id" .= aPIKeyId+ , "secret" .= aPIKeySecret+ , "name" .= aPIKeyName+ , "nonce" .= aPIKeyNonce+ , "cidr" .= aPIKeyCidr+ , "permissions" .= aPIKeyPermissions+ , "enabled" .= aPIKeyEnabled+ , "userId" .= aPIKeyUserId+ , "created" .= aPIKeyCreated+ ]+++-- | Construct a value of type 'APIKey' (by applying it's required fields, if any)+mkAPIKey+ :: Text -- ^ 'aPIKeyId' + -> Text -- ^ 'aPIKeySecret' + -> Text -- ^ 'aPIKeyName' + -> Double -- ^ 'aPIKeyNonce' + -> Double -- ^ 'aPIKeyUserId' + -> APIKey+mkAPIKey aPIKeyId aPIKeySecret aPIKeyName aPIKeyNonce aPIKeyUserId =+ APIKey+ { aPIKeyId+ , aPIKeySecret+ , aPIKeyName+ , aPIKeyNonce+ , aPIKeyCidr = Nothing+ , aPIKeyPermissions = Nothing+ , aPIKeyEnabled = Nothing+ , aPIKeyUserId+ , aPIKeyCreated = Nothing+ }++-- ** AccessToken+-- | AccessToken+data AccessToken = AccessToken+ { accessTokenId :: !(Text) -- ^ /Required/ "id"+ , accessTokenTtl :: !(Maybe Double) -- ^ "ttl" - time to live in seconds (2 weeks by default)+ , accessTokenCreated :: !(Maybe DateTime) -- ^ "created"+ , accessTokenUserId :: !(Maybe Double) -- ^ "userId"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON AccessToken+instance A.FromJSON AccessToken where+ parseJSON = A.withObject "AccessToken" $ \o ->+ AccessToken+ <$> (o .: "id")+ <*> (o .:? "ttl")+ <*> (o .:? "created")+ <*> (o .:? "userId")++-- | ToJSON AccessToken+instance A.ToJSON AccessToken where+ toJSON AccessToken {..} =+ _omitNulls+ [ "id" .= accessTokenId+ , "ttl" .= accessTokenTtl+ , "created" .= accessTokenCreated+ , "userId" .= accessTokenUserId+ ]+++-- | Construct a value of type 'AccessToken' (by applying it's required fields, if any)+mkAccessToken+ :: Text -- ^ 'accessTokenId' + -> AccessToken+mkAccessToken accessTokenId =+ AccessToken+ { accessTokenId+ , accessTokenTtl = Nothing+ , accessTokenCreated = Nothing+ , accessTokenUserId = Nothing+ }++-- ** Affiliate+-- | Affiliate+data Affiliate = Affiliate+ { affiliateAccount :: !(Double) -- ^ /Required/ "account"+ , affiliateCurrency :: !(Text) -- ^ /Required/ "currency"+ , affiliatePrevPayout :: !(Maybe Double) -- ^ "prevPayout"+ , affiliatePrevTurnover :: !(Maybe Double) -- ^ "prevTurnover"+ , affiliatePrevComm :: !(Maybe Double) -- ^ "prevComm"+ , affiliatePrevTimestamp :: !(Maybe DateTime) -- ^ "prevTimestamp"+ , affiliateExecTurnover :: !(Maybe Double) -- ^ "execTurnover"+ , affiliateExecComm :: !(Maybe Double) -- ^ "execComm"+ , affiliateTotalReferrals :: !(Maybe Double) -- ^ "totalReferrals"+ , affiliateTotalTurnover :: !(Maybe Double) -- ^ "totalTurnover"+ , affiliateTotalComm :: !(Maybe Double) -- ^ "totalComm"+ , affiliatePayoutPcnt :: !(Maybe Double) -- ^ "payoutPcnt"+ , affiliatePendingPayout :: !(Maybe Double) -- ^ "pendingPayout"+ , affiliateTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ , affiliateReferrerAccount :: !(Maybe Double) -- ^ "referrerAccount"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Affiliate+instance A.FromJSON Affiliate where+ parseJSON = A.withObject "Affiliate" $ \o ->+ Affiliate+ <$> (o .: "account")+ <*> (o .: "currency")+ <*> (o .:? "prevPayout")+ <*> (o .:? "prevTurnover")+ <*> (o .:? "prevComm")+ <*> (o .:? "prevTimestamp")+ <*> (o .:? "execTurnover")+ <*> (o .:? "execComm")+ <*> (o .:? "totalReferrals")+ <*> (o .:? "totalTurnover")+ <*> (o .:? "totalComm")+ <*> (o .:? "payoutPcnt")+ <*> (o .:? "pendingPayout")+ <*> (o .:? "timestamp")+ <*> (o .:? "referrerAccount")++-- | ToJSON Affiliate+instance A.ToJSON Affiliate where+ toJSON Affiliate {..} =+ _omitNulls+ [ "account" .= affiliateAccount+ , "currency" .= affiliateCurrency+ , "prevPayout" .= affiliatePrevPayout+ , "prevTurnover" .= affiliatePrevTurnover+ , "prevComm" .= affiliatePrevComm+ , "prevTimestamp" .= affiliatePrevTimestamp+ , "execTurnover" .= affiliateExecTurnover+ , "execComm" .= affiliateExecComm+ , "totalReferrals" .= affiliateTotalReferrals+ , "totalTurnover" .= affiliateTotalTurnover+ , "totalComm" .= affiliateTotalComm+ , "payoutPcnt" .= affiliatePayoutPcnt+ , "pendingPayout" .= affiliatePendingPayout+ , "timestamp" .= affiliateTimestamp+ , "referrerAccount" .= affiliateReferrerAccount+ ]+++-- | Construct a value of type 'Affiliate' (by applying it's required fields, if any)+mkAffiliate+ :: Double -- ^ 'affiliateAccount' + -> Text -- ^ 'affiliateCurrency' + -> Affiliate+mkAffiliate affiliateAccount affiliateCurrency =+ Affiliate+ { affiliateAccount+ , affiliateCurrency+ , affiliatePrevPayout = Nothing+ , affiliatePrevTurnover = Nothing+ , affiliatePrevComm = Nothing+ , affiliatePrevTimestamp = Nothing+ , affiliateExecTurnover = Nothing+ , affiliateExecComm = Nothing+ , affiliateTotalReferrals = Nothing+ , affiliateTotalTurnover = Nothing+ , affiliateTotalComm = Nothing+ , affiliatePayoutPcnt = Nothing+ , affiliatePendingPayout = Nothing+ , affiliateTimestamp = Nothing+ , affiliateReferrerAccount = Nothing+ }++-- ** Announcement+-- | Announcement+-- Public Announcements+data Announcement = Announcement+ { announcementId :: !(Double) -- ^ /Required/ "id"+ , announcementLink :: !(Maybe Text) -- ^ "link"+ , announcementTitle :: !(Maybe Text) -- ^ "title"+ , announcementContent :: !(Maybe Text) -- ^ "content"+ , announcementDate :: !(Maybe DateTime) -- ^ "date"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Announcement+instance A.FromJSON Announcement where+ parseJSON = A.withObject "Announcement" $ \o ->+ Announcement+ <$> (o .: "id")+ <*> (o .:? "link")+ <*> (o .:? "title")+ <*> (o .:? "content")+ <*> (o .:? "date")++-- | ToJSON Announcement+instance A.ToJSON Announcement where+ toJSON Announcement {..} =+ _omitNulls+ [ "id" .= announcementId+ , "link" .= announcementLink+ , "title" .= announcementTitle+ , "content" .= announcementContent+ , "date" .= announcementDate+ ]+++-- | Construct a value of type 'Announcement' (by applying it's required fields, if any)+mkAnnouncement+ :: Double -- ^ 'announcementId' + -> Announcement+mkAnnouncement announcementId =+ Announcement+ { announcementId+ , announcementLink = Nothing+ , announcementTitle = Nothing+ , announcementContent = Nothing+ , announcementDate = Nothing+ }++-- ** Chat+-- | Chat+-- Trollbox Data+data Chat = Chat+ { chatId :: !(Maybe Double) -- ^ "id"+ , chatDate :: !(DateTime) -- ^ /Required/ "date"+ , chatUser :: !(Text) -- ^ /Required/ "user"+ , chatMessage :: !(Text) -- ^ /Required/ "message"+ , chatHtml :: !(Text) -- ^ /Required/ "html"+ , chatFromBot :: !(Maybe Bool) -- ^ "fromBot"+ , chatChannelId :: !(Maybe Double) -- ^ "channelID"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Chat+instance A.FromJSON Chat where+ parseJSON = A.withObject "Chat" $ \o ->+ Chat+ <$> (o .:? "id")+ <*> (o .: "date")+ <*> (o .: "user")+ <*> (o .: "message")+ <*> (o .: "html")+ <*> (o .:? "fromBot")+ <*> (o .:? "channelID")++-- | ToJSON Chat+instance A.ToJSON Chat where+ toJSON Chat {..} =+ _omitNulls+ [ "id" .= chatId+ , "date" .= chatDate+ , "user" .= chatUser+ , "message" .= chatMessage+ , "html" .= chatHtml+ , "fromBot" .= chatFromBot+ , "channelID" .= chatChannelId+ ]+++-- | Construct a value of type 'Chat' (by applying it's required fields, if any)+mkChat+ :: DateTime -- ^ 'chatDate' + -> Text -- ^ 'chatUser' + -> Text -- ^ 'chatMessage' + -> Text -- ^ 'chatHtml' + -> Chat+mkChat chatDate chatUser chatMessage chatHtml =+ Chat+ { chatId = Nothing+ , chatDate+ , chatUser+ , chatMessage+ , chatHtml+ , chatFromBot = Nothing+ , chatChannelId = Nothing+ }++-- ** ChatChannels+-- | ChatChannels+data ChatChannels = ChatChannels+ { chatChannelsId :: !(Maybe Double) -- ^ "id"+ , chatChannelsName :: !(Text) -- ^ /Required/ "name"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON ChatChannels+instance A.FromJSON ChatChannels where+ parseJSON = A.withObject "ChatChannels" $ \o ->+ ChatChannels+ <$> (o .:? "id")+ <*> (o .: "name")++-- | ToJSON ChatChannels+instance A.ToJSON ChatChannels where+ toJSON ChatChannels {..} =+ _omitNulls+ [ "id" .= chatChannelsId+ , "name" .= chatChannelsName+ ]+++-- | Construct a value of type 'ChatChannels' (by applying it's required fields, if any)+mkChatChannels+ :: Text -- ^ 'chatChannelsName' + -> ChatChannels+mkChatChannels chatChannelsName =+ ChatChannels+ { chatChannelsId = Nothing+ , chatChannelsName+ }++-- ** ConnectedUsers+-- | ConnectedUsers+data ConnectedUsers = ConnectedUsers+ { connectedUsersUsers :: !(Maybe Double) -- ^ "users"+ , connectedUsersBots :: !(Maybe Double) -- ^ "bots"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON ConnectedUsers+instance A.FromJSON ConnectedUsers where+ parseJSON = A.withObject "ConnectedUsers" $ \o ->+ ConnectedUsers+ <$> (o .:? "users")+ <*> (o .:? "bots")++-- | ToJSON ConnectedUsers+instance A.ToJSON ConnectedUsers where+ toJSON ConnectedUsers {..} =+ _omitNulls+ [ "users" .= connectedUsersUsers+ , "bots" .= connectedUsersBots+ ]+++-- | Construct a value of type 'ConnectedUsers' (by applying it's required fields, if any)+mkConnectedUsers+ :: ConnectedUsers+mkConnectedUsers =+ ConnectedUsers+ { connectedUsersUsers = Nothing+ , connectedUsersBots = Nothing+ }++-- ** Error+-- | Error+data Error = Error+ { errorError :: !(ErrorError) -- ^ /Required/ "error"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Error+instance A.FromJSON Error where+ parseJSON = A.withObject "Error" $ \o ->+ Error+ <$> (o .: "error")++-- | ToJSON Error+instance A.ToJSON Error where+ toJSON Error {..} =+ _omitNulls+ [ "error" .= errorError+ ]+++-- | Construct a value of type 'Error' (by applying it's required fields, if any)+mkError+ :: ErrorError -- ^ 'errorError' + -> Error+mkError errorError =+ Error+ { errorError+ }++-- ** ErrorError+-- | ErrorError+data ErrorError = ErrorError+ { errorErrorMessage :: !(Maybe Text) -- ^ "message"+ , errorErrorName :: !(Maybe Text) -- ^ "name"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON ErrorError+instance A.FromJSON ErrorError where+ parseJSON = A.withObject "ErrorError" $ \o ->+ ErrorError+ <$> (o .:? "message")+ <*> (o .:? "name")++-- | ToJSON ErrorError+instance A.ToJSON ErrorError where+ toJSON ErrorError {..} =+ _omitNulls+ [ "message" .= errorErrorMessage+ , "name" .= errorErrorName+ ]+++-- | Construct a value of type 'ErrorError' (by applying it's required fields, if any)+mkErrorError+ :: ErrorError+mkErrorError =+ ErrorError+ { errorErrorMessage = Nothing+ , errorErrorName = Nothing+ }++-- ** Execution+-- | Execution+-- Raw Order and Balance Data+data Execution = Execution+ { executionExecId :: !(Text) -- ^ /Required/ "execID"+ , executionOrderId :: !(Maybe Text) -- ^ "orderID"+ , executionClOrdId :: !(Maybe Text) -- ^ "clOrdID"+ , executionClOrdLinkId :: !(Maybe Text) -- ^ "clOrdLinkID"+ , executionAccount :: !(Maybe Double) -- ^ "account"+ , executionSymbol :: !(Maybe Text) -- ^ "symbol"+ , executionSide :: !(Maybe Text) -- ^ "side"+ , executionLastQty :: !(Maybe Double) -- ^ "lastQty"+ , executionLastPx :: !(Maybe Double) -- ^ "lastPx"+ , executionUnderlyingLastPx :: !(Maybe Double) -- ^ "underlyingLastPx"+ , executionLastMkt :: !(Maybe Text) -- ^ "lastMkt"+ , executionLastLiquidityInd :: !(Maybe Text) -- ^ "lastLiquidityInd"+ , executionSimpleOrderQty :: !(Maybe Double) -- ^ "simpleOrderQty"+ , executionOrderQty :: !(Maybe Double) -- ^ "orderQty"+ , executionPrice :: !(Maybe Double) -- ^ "price"+ , executionDisplayQty :: !(Maybe Double) -- ^ "displayQty"+ , executionStopPx :: !(Maybe Double) -- ^ "stopPx"+ , executionPegOffsetValue :: !(Maybe Double) -- ^ "pegOffsetValue"+ , executionPegPriceType :: !(Maybe Text) -- ^ "pegPriceType"+ , executionCurrency :: !(Maybe Text) -- ^ "currency"+ , executionSettlCurrency :: !(Maybe Text) -- ^ "settlCurrency"+ , executionExecType :: !(Maybe Text) -- ^ "execType"+ , executionOrdType :: !(Maybe Text) -- ^ "ordType"+ , executionTimeInForce :: !(Maybe Text) -- ^ "timeInForce"+ , executionExecInst :: !(Maybe Text) -- ^ "execInst"+ , executionContingencyType :: !(Maybe Text) -- ^ "contingencyType"+ , executionExDestination :: !(Maybe Text) -- ^ "exDestination"+ , executionOrdStatus :: !(Maybe Text) -- ^ "ordStatus"+ , executionTriggered :: !(Maybe Text) -- ^ "triggered"+ , executionWorkingIndicator :: !(Maybe Bool) -- ^ "workingIndicator"+ , executionOrdRejReason :: !(Maybe Text) -- ^ "ordRejReason"+ , executionSimpleLeavesQty :: !(Maybe Double) -- ^ "simpleLeavesQty"+ , executionLeavesQty :: !(Maybe Double) -- ^ "leavesQty"+ , executionSimpleCumQty :: !(Maybe Double) -- ^ "simpleCumQty"+ , executionCumQty :: !(Maybe Double) -- ^ "cumQty"+ , executionAvgPx :: !(Maybe Double) -- ^ "avgPx"+ , executionCommission :: !(Maybe Double) -- ^ "commission"+ , executionTradePublishIndicator :: !(Maybe Text) -- ^ "tradePublishIndicator"+ , executionMultiLegReportingType :: !(Maybe Text) -- ^ "multiLegReportingType"+ , executionText :: !(Maybe Text) -- ^ "text"+ , executionTrdMatchId :: !(Maybe Text) -- ^ "trdMatchID"+ , executionExecCost :: !(Maybe Double) -- ^ "execCost"+ , executionExecComm :: !(Maybe Double) -- ^ "execComm"+ , executionHomeNotional :: !(Maybe Double) -- ^ "homeNotional"+ , executionForeignNotional :: !(Maybe Double) -- ^ "foreignNotional"+ , executionTransactTime :: !(Maybe DateTime) -- ^ "transactTime"+ , executionTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Execution+instance A.FromJSON Execution where+ parseJSON = A.withObject "Execution" $ \o ->+ Execution+ <$> (o .: "execID")+ <*> (o .:? "orderID")+ <*> (o .:? "clOrdID")+ <*> (o .:? "clOrdLinkID")+ <*> (o .:? "account")+ <*> (o .:? "symbol")+ <*> (o .:? "side")+ <*> (o .:? "lastQty")+ <*> (o .:? "lastPx")+ <*> (o .:? "underlyingLastPx")+ <*> (o .:? "lastMkt")+ <*> (o .:? "lastLiquidityInd")+ <*> (o .:? "simpleOrderQty")+ <*> (o .:? "orderQty")+ <*> (o .:? "price")+ <*> (o .:? "displayQty")+ <*> (o .:? "stopPx")+ <*> (o .:? "pegOffsetValue")+ <*> (o .:? "pegPriceType")+ <*> (o .:? "currency")+ <*> (o .:? "settlCurrency")+ <*> (o .:? "execType")+ <*> (o .:? "ordType")+ <*> (o .:? "timeInForce")+ <*> (o .:? "execInst")+ <*> (o .:? "contingencyType")+ <*> (o .:? "exDestination")+ <*> (o .:? "ordStatus")+ <*> (o .:? "triggered")+ <*> (o .:? "workingIndicator")+ <*> (o .:? "ordRejReason")+ <*> (o .:? "simpleLeavesQty")+ <*> (o .:? "leavesQty")+ <*> (o .:? "simpleCumQty")+ <*> (o .:? "cumQty")+ <*> (o .:? "avgPx")+ <*> (o .:? "commission")+ <*> (o .:? "tradePublishIndicator")+ <*> (o .:? "multiLegReportingType")+ <*> (o .:? "text")+ <*> (o .:? "trdMatchID")+ <*> (o .:? "execCost")+ <*> (o .:? "execComm")+ <*> (o .:? "homeNotional")+ <*> (o .:? "foreignNotional")+ <*> (o .:? "transactTime")+ <*> (o .:? "timestamp")++-- | ToJSON Execution+instance A.ToJSON Execution where+ toJSON Execution {..} =+ _omitNulls+ [ "execID" .= executionExecId+ , "orderID" .= executionOrderId+ , "clOrdID" .= executionClOrdId+ , "clOrdLinkID" .= executionClOrdLinkId+ , "account" .= executionAccount+ , "symbol" .= executionSymbol+ , "side" .= executionSide+ , "lastQty" .= executionLastQty+ , "lastPx" .= executionLastPx+ , "underlyingLastPx" .= executionUnderlyingLastPx+ , "lastMkt" .= executionLastMkt+ , "lastLiquidityInd" .= executionLastLiquidityInd+ , "simpleOrderQty" .= executionSimpleOrderQty+ , "orderQty" .= executionOrderQty+ , "price" .= executionPrice+ , "displayQty" .= executionDisplayQty+ , "stopPx" .= executionStopPx+ , "pegOffsetValue" .= executionPegOffsetValue+ , "pegPriceType" .= executionPegPriceType+ , "currency" .= executionCurrency+ , "settlCurrency" .= executionSettlCurrency+ , "execType" .= executionExecType+ , "ordType" .= executionOrdType+ , "timeInForce" .= executionTimeInForce+ , "execInst" .= executionExecInst+ , "contingencyType" .= executionContingencyType+ , "exDestination" .= executionExDestination+ , "ordStatus" .= executionOrdStatus+ , "triggered" .= executionTriggered+ , "workingIndicator" .= executionWorkingIndicator+ , "ordRejReason" .= executionOrdRejReason+ , "simpleLeavesQty" .= executionSimpleLeavesQty+ , "leavesQty" .= executionLeavesQty+ , "simpleCumQty" .= executionSimpleCumQty+ , "cumQty" .= executionCumQty+ , "avgPx" .= executionAvgPx+ , "commission" .= executionCommission+ , "tradePublishIndicator" .= executionTradePublishIndicator+ , "multiLegReportingType" .= executionMultiLegReportingType+ , "text" .= executionText+ , "trdMatchID" .= executionTrdMatchId+ , "execCost" .= executionExecCost+ , "execComm" .= executionExecComm+ , "homeNotional" .= executionHomeNotional+ , "foreignNotional" .= executionForeignNotional+ , "transactTime" .= executionTransactTime+ , "timestamp" .= executionTimestamp+ ]+++-- | Construct a value of type 'Execution' (by applying it's required fields, if any)+mkExecution+ :: Text -- ^ 'executionExecId' + -> Execution+mkExecution executionExecId =+ Execution+ { executionExecId+ , executionOrderId = Nothing+ , executionClOrdId = Nothing+ , executionClOrdLinkId = Nothing+ , executionAccount = Nothing+ , executionSymbol = Nothing+ , executionSide = Nothing+ , executionLastQty = Nothing+ , executionLastPx = Nothing+ , executionUnderlyingLastPx = Nothing+ , executionLastMkt = Nothing+ , executionLastLiquidityInd = Nothing+ , executionSimpleOrderQty = Nothing+ , executionOrderQty = Nothing+ , executionPrice = Nothing+ , executionDisplayQty = Nothing+ , executionStopPx = Nothing+ , executionPegOffsetValue = Nothing+ , executionPegPriceType = Nothing+ , executionCurrency = Nothing+ , executionSettlCurrency = Nothing+ , executionExecType = Nothing+ , executionOrdType = Nothing+ , executionTimeInForce = Nothing+ , executionExecInst = Nothing+ , executionContingencyType = Nothing+ , executionExDestination = Nothing+ , executionOrdStatus = Nothing+ , executionTriggered = Nothing+ , executionWorkingIndicator = Nothing+ , executionOrdRejReason = Nothing+ , executionSimpleLeavesQty = Nothing+ , executionLeavesQty = Nothing+ , executionSimpleCumQty = Nothing+ , executionCumQty = Nothing+ , executionAvgPx = Nothing+ , executionCommission = Nothing+ , executionTradePublishIndicator = Nothing+ , executionMultiLegReportingType = Nothing+ , executionText = Nothing+ , executionTrdMatchId = Nothing+ , executionExecCost = Nothing+ , executionExecComm = Nothing+ , executionHomeNotional = Nothing+ , executionForeignNotional = Nothing+ , executionTransactTime = Nothing+ , executionTimestamp = Nothing+ }++-- ** Funding+-- | Funding+-- Swap Funding History+data Funding = Funding+ { fundingTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , fundingSymbol :: !(Text) -- ^ /Required/ "symbol"+ , fundingFundingInterval :: !(Maybe DateTime) -- ^ "fundingInterval"+ , fundingFundingRate :: !(Maybe Double) -- ^ "fundingRate"+ , fundingFundingRateDaily :: !(Maybe Double) -- ^ "fundingRateDaily"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Funding+instance A.FromJSON Funding where+ parseJSON = A.withObject "Funding" $ \o ->+ Funding+ <$> (o .: "timestamp")+ <*> (o .: "symbol")+ <*> (o .:? "fundingInterval")+ <*> (o .:? "fundingRate")+ <*> (o .:? "fundingRateDaily")++-- | ToJSON Funding+instance A.ToJSON Funding where+ toJSON Funding {..} =+ _omitNulls+ [ "timestamp" .= fundingTimestamp+ , "symbol" .= fundingSymbol+ , "fundingInterval" .= fundingFundingInterval+ , "fundingRate" .= fundingFundingRate+ , "fundingRateDaily" .= fundingFundingRateDaily+ ]+++-- | Construct a value of type 'Funding' (by applying it's required fields, if any)+mkFunding+ :: DateTime -- ^ 'fundingTimestamp' + -> Text -- ^ 'fundingSymbol' + -> Funding+mkFunding fundingTimestamp fundingSymbol =+ Funding+ { fundingTimestamp+ , fundingSymbol+ , fundingFundingInterval = Nothing+ , fundingFundingRate = Nothing+ , fundingFundingRateDaily = Nothing+ }++-- ** IndexComposite+-- | IndexComposite+data IndexComposite = IndexComposite+ { indexCompositeTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , indexCompositeSymbol :: !(Maybe Text) -- ^ "symbol"+ , indexCompositeIndexSymbol :: !(Maybe Text) -- ^ "indexSymbol"+ , indexCompositeReference :: !(Maybe Text) -- ^ "reference"+ , indexCompositeLastPrice :: !(Maybe Double) -- ^ "lastPrice"+ , indexCompositeWeight :: !(Maybe Double) -- ^ "weight"+ , indexCompositeLogged :: !(Maybe DateTime) -- ^ "logged"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON IndexComposite+instance A.FromJSON IndexComposite where+ parseJSON = A.withObject "IndexComposite" $ \o ->+ IndexComposite+ <$> (o .: "timestamp")+ <*> (o .:? "symbol")+ <*> (o .:? "indexSymbol")+ <*> (o .:? "reference")+ <*> (o .:? "lastPrice")+ <*> (o .:? "weight")+ <*> (o .:? "logged")++-- | ToJSON IndexComposite+instance A.ToJSON IndexComposite where+ toJSON IndexComposite {..} =+ _omitNulls+ [ "timestamp" .= indexCompositeTimestamp+ , "symbol" .= indexCompositeSymbol+ , "indexSymbol" .= indexCompositeIndexSymbol+ , "reference" .= indexCompositeReference+ , "lastPrice" .= indexCompositeLastPrice+ , "weight" .= indexCompositeWeight+ , "logged" .= indexCompositeLogged+ ]+++-- | Construct a value of type 'IndexComposite' (by applying it's required fields, if any)+mkIndexComposite+ :: DateTime -- ^ 'indexCompositeTimestamp' + -> IndexComposite+mkIndexComposite indexCompositeTimestamp =+ IndexComposite+ { indexCompositeTimestamp+ , indexCompositeSymbol = Nothing+ , indexCompositeIndexSymbol = Nothing+ , indexCompositeReference = Nothing+ , indexCompositeLastPrice = Nothing+ , indexCompositeWeight = Nothing+ , indexCompositeLogged = Nothing+ }++-- ** InlineResponse200+-- | InlineResponse200+data InlineResponse200 = InlineResponse200+ { inlineResponse200Success :: !(Maybe Bool) -- ^ "success"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON InlineResponse200+instance A.FromJSON InlineResponse200 where+ parseJSON = A.withObject "InlineResponse200" $ \o ->+ InlineResponse200+ <$> (o .:? "success")++-- | ToJSON InlineResponse200+instance A.ToJSON InlineResponse200 where+ toJSON InlineResponse200 {..} =+ _omitNulls+ [ "success" .= inlineResponse200Success+ ]+++-- | Construct a value of type 'InlineResponse200' (by applying it's required fields, if any)+mkInlineResponse200+ :: InlineResponse200+mkInlineResponse200 =+ InlineResponse200+ { inlineResponse200Success = Nothing+ }++-- ** Instrument+-- | Instrument+-- Tradeable Contracts, Indices, and History+data Instrument = Instrument+ { instrumentSymbol :: !(Text) -- ^ /Required/ "symbol"+ , instrumentRootSymbol :: !(Maybe Text) -- ^ "rootSymbol"+ , instrumentState :: !(Maybe Text) -- ^ "state"+ , instrumentTyp :: !(Maybe Text) -- ^ "typ"+ , instrumentListing :: !(Maybe DateTime) -- ^ "listing"+ , instrumentFront :: !(Maybe DateTime) -- ^ "front"+ , instrumentExpiry :: !(Maybe DateTime) -- ^ "expiry"+ , instrumentSettle :: !(Maybe DateTime) -- ^ "settle"+ , instrumentRelistInterval :: !(Maybe DateTime) -- ^ "relistInterval"+ , instrumentInverseLeg :: !(Maybe Text) -- ^ "inverseLeg"+ , instrumentSellLeg :: !(Maybe Text) -- ^ "sellLeg"+ , instrumentBuyLeg :: !(Maybe Text) -- ^ "buyLeg"+ , instrumentPositionCurrency :: !(Maybe Text) -- ^ "positionCurrency"+ , instrumentUnderlying :: !(Maybe Text) -- ^ "underlying"+ , instrumentQuoteCurrency :: !(Maybe Text) -- ^ "quoteCurrency"+ , instrumentUnderlyingSymbol :: !(Maybe Text) -- ^ "underlyingSymbol"+ , instrumentReference :: !(Maybe Text) -- ^ "reference"+ , instrumentReferenceSymbol :: !(Maybe Text) -- ^ "referenceSymbol"+ , instrumentCalcInterval :: !(Maybe DateTime) -- ^ "calcInterval"+ , instrumentPublishInterval :: !(Maybe DateTime) -- ^ "publishInterval"+ , instrumentPublishTime :: !(Maybe DateTime) -- ^ "publishTime"+ , instrumentMaxOrderQty :: !(Maybe Double) -- ^ "maxOrderQty"+ , instrumentMaxPrice :: !(Maybe Double) -- ^ "maxPrice"+ , instrumentLotSize :: !(Maybe Double) -- ^ "lotSize"+ , instrumentTickSize :: !(Maybe Double) -- ^ "tickSize"+ , instrumentMultiplier :: !(Maybe Double) -- ^ "multiplier"+ , instrumentSettlCurrency :: !(Maybe Text) -- ^ "settlCurrency"+ , instrumentUnderlyingToPositionMultiplier :: !(Maybe Double) -- ^ "underlyingToPositionMultiplier"+ , instrumentUnderlyingToSettleMultiplier :: !(Maybe Double) -- ^ "underlyingToSettleMultiplier"+ , instrumentQuoteToSettleMultiplier :: !(Maybe Double) -- ^ "quoteToSettleMultiplier"+ , instrumentIsQuanto :: !(Maybe Bool) -- ^ "isQuanto"+ , instrumentIsInverse :: !(Maybe Bool) -- ^ "isInverse"+ , instrumentInitMargin :: !(Maybe Double) -- ^ "initMargin"+ , instrumentMaintMargin :: !(Maybe Double) -- ^ "maintMargin"+ , instrumentRiskLimit :: !(Maybe Double) -- ^ "riskLimit"+ , instrumentRiskStep :: !(Maybe Double) -- ^ "riskStep"+ , instrumentLimit :: !(Maybe Double) -- ^ "limit"+ , instrumentCapped :: !(Maybe Bool) -- ^ "capped"+ , instrumentTaxed :: !(Maybe Bool) -- ^ "taxed"+ , instrumentDeleverage :: !(Maybe Bool) -- ^ "deleverage"+ , instrumentMakerFee :: !(Maybe Double) -- ^ "makerFee"+ , instrumentTakerFee :: !(Maybe Double) -- ^ "takerFee"+ , instrumentSettlementFee :: !(Maybe Double) -- ^ "settlementFee"+ , instrumentInsuranceFee :: !(Maybe Double) -- ^ "insuranceFee"+ , instrumentFundingBaseSymbol :: !(Maybe Text) -- ^ "fundingBaseSymbol"+ , instrumentFundingQuoteSymbol :: !(Maybe Text) -- ^ "fundingQuoteSymbol"+ , instrumentFundingPremiumSymbol :: !(Maybe Text) -- ^ "fundingPremiumSymbol"+ , instrumentFundingTimestamp :: !(Maybe DateTime) -- ^ "fundingTimestamp"+ , instrumentFundingInterval :: !(Maybe DateTime) -- ^ "fundingInterval"+ , instrumentFundingRate :: !(Maybe Double) -- ^ "fundingRate"+ , instrumentIndicativeFundingRate :: !(Maybe Double) -- ^ "indicativeFundingRate"+ , instrumentRebalanceTimestamp :: !(Maybe DateTime) -- ^ "rebalanceTimestamp"+ , instrumentRebalanceInterval :: !(Maybe DateTime) -- ^ "rebalanceInterval"+ , instrumentOpeningTimestamp :: !(Maybe DateTime) -- ^ "openingTimestamp"+ , instrumentClosingTimestamp :: !(Maybe DateTime) -- ^ "closingTimestamp"+ , instrumentSessionInterval :: !(Maybe DateTime) -- ^ "sessionInterval"+ , instrumentPrevClosePrice :: !(Maybe Double) -- ^ "prevClosePrice"+ , instrumentLimitDownPrice :: !(Maybe Double) -- ^ "limitDownPrice"+ , instrumentLimitUpPrice :: !(Maybe Double) -- ^ "limitUpPrice"+ , instrumentBankruptLimitDownPrice :: !(Maybe Double) -- ^ "bankruptLimitDownPrice"+ , instrumentBankruptLimitUpPrice :: !(Maybe Double) -- ^ "bankruptLimitUpPrice"+ , instrumentPrevTotalVolume :: !(Maybe Double) -- ^ "prevTotalVolume"+ , instrumentTotalVolume :: !(Maybe Double) -- ^ "totalVolume"+ , instrumentVolume :: !(Maybe Double) -- ^ "volume"+ , instrumentVolume24h :: !(Maybe Double) -- ^ "volume24h"+ , instrumentPrevTotalTurnover :: !(Maybe Double) -- ^ "prevTotalTurnover"+ , instrumentTotalTurnover :: !(Maybe Double) -- ^ "totalTurnover"+ , instrumentTurnover :: !(Maybe Double) -- ^ "turnover"+ , instrumentTurnover24h :: !(Maybe Double) -- ^ "turnover24h"+ , instrumentPrevPrice24h :: !(Maybe Double) -- ^ "prevPrice24h"+ , instrumentVwap :: !(Maybe Double) -- ^ "vwap"+ , instrumentHighPrice :: !(Maybe Double) -- ^ "highPrice"+ , instrumentLowPrice :: !(Maybe Double) -- ^ "lowPrice"+ , instrumentLastPrice :: !(Maybe Double) -- ^ "lastPrice"+ , instrumentLastPriceProtected :: !(Maybe Double) -- ^ "lastPriceProtected"+ , instrumentLastTickDirection :: !(Maybe Text) -- ^ "lastTickDirection"+ , instrumentLastChangePcnt :: !(Maybe Double) -- ^ "lastChangePcnt"+ , instrumentBidPrice :: !(Maybe Double) -- ^ "bidPrice"+ , instrumentMidPrice :: !(Maybe Double) -- ^ "midPrice"+ , instrumentAskPrice :: !(Maybe Double) -- ^ "askPrice"+ , instrumentImpactBidPrice :: !(Maybe Double) -- ^ "impactBidPrice"+ , instrumentImpactMidPrice :: !(Maybe Double) -- ^ "impactMidPrice"+ , instrumentImpactAskPrice :: !(Maybe Double) -- ^ "impactAskPrice"+ , instrumentHasLiquidity :: !(Maybe Bool) -- ^ "hasLiquidity"+ , instrumentOpenInterest :: !(Maybe Double) -- ^ "openInterest"+ , instrumentOpenValue :: !(Maybe Double) -- ^ "openValue"+ , instrumentFairMethod :: !(Maybe Text) -- ^ "fairMethod"+ , instrumentFairBasisRate :: !(Maybe Double) -- ^ "fairBasisRate"+ , instrumentFairBasis :: !(Maybe Double) -- ^ "fairBasis"+ , instrumentFairPrice :: !(Maybe Double) -- ^ "fairPrice"+ , instrumentMarkMethod :: !(Maybe Text) -- ^ "markMethod"+ , instrumentMarkPrice :: !(Maybe Double) -- ^ "markPrice"+ , instrumentIndicativeTaxRate :: !(Maybe Double) -- ^ "indicativeTaxRate"+ , instrumentIndicativeSettlePrice :: !(Maybe Double) -- ^ "indicativeSettlePrice"+ , instrumentSettledPrice :: !(Maybe Double) -- ^ "settledPrice"+ , instrumentTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Instrument+instance A.FromJSON Instrument where+ parseJSON = A.withObject "Instrument" $ \o ->+ Instrument+ <$> (o .: "symbol")+ <*> (o .:? "rootSymbol")+ <*> (o .:? "state")+ <*> (o .:? "typ")+ <*> (o .:? "listing")+ <*> (o .:? "front")+ <*> (o .:? "expiry")+ <*> (o .:? "settle")+ <*> (o .:? "relistInterval")+ <*> (o .:? "inverseLeg")+ <*> (o .:? "sellLeg")+ <*> (o .:? "buyLeg")+ <*> (o .:? "positionCurrency")+ <*> (o .:? "underlying")+ <*> (o .:? "quoteCurrency")+ <*> (o .:? "underlyingSymbol")+ <*> (o .:? "reference")+ <*> (o .:? "referenceSymbol")+ <*> (o .:? "calcInterval")+ <*> (o .:? "publishInterval")+ <*> (o .:? "publishTime")+ <*> (o .:? "maxOrderQty")+ <*> (o .:? "maxPrice")+ <*> (o .:? "lotSize")+ <*> (o .:? "tickSize")+ <*> (o .:? "multiplier")+ <*> (o .:? "settlCurrency")+ <*> (o .:? "underlyingToPositionMultiplier")+ <*> (o .:? "underlyingToSettleMultiplier")+ <*> (o .:? "quoteToSettleMultiplier")+ <*> (o .:? "isQuanto")+ <*> (o .:? "isInverse")+ <*> (o .:? "initMargin")+ <*> (o .:? "maintMargin")+ <*> (o .:? "riskLimit")+ <*> (o .:? "riskStep")+ <*> (o .:? "limit")+ <*> (o .:? "capped")+ <*> (o .:? "taxed")+ <*> (o .:? "deleverage")+ <*> (o .:? "makerFee")+ <*> (o .:? "takerFee")+ <*> (o .:? "settlementFee")+ <*> (o .:? "insuranceFee")+ <*> (o .:? "fundingBaseSymbol")+ <*> (o .:? "fundingQuoteSymbol")+ <*> (o .:? "fundingPremiumSymbol")+ <*> (o .:? "fundingTimestamp")+ <*> (o .:? "fundingInterval")+ <*> (o .:? "fundingRate")+ <*> (o .:? "indicativeFundingRate")+ <*> (o .:? "rebalanceTimestamp")+ <*> (o .:? "rebalanceInterval")+ <*> (o .:? "openingTimestamp")+ <*> (o .:? "closingTimestamp")+ <*> (o .:? "sessionInterval")+ <*> (o .:? "prevClosePrice")+ <*> (o .:? "limitDownPrice")+ <*> (o .:? "limitUpPrice")+ <*> (o .:? "bankruptLimitDownPrice")+ <*> (o .:? "bankruptLimitUpPrice")+ <*> (o .:? "prevTotalVolume")+ <*> (o .:? "totalVolume")+ <*> (o .:? "volume")+ <*> (o .:? "volume24h")+ <*> (o .:? "prevTotalTurnover")+ <*> (o .:? "totalTurnover")+ <*> (o .:? "turnover")+ <*> (o .:? "turnover24h")+ <*> (o .:? "prevPrice24h")+ <*> (o .:? "vwap")+ <*> (o .:? "highPrice")+ <*> (o .:? "lowPrice")+ <*> (o .:? "lastPrice")+ <*> (o .:? "lastPriceProtected")+ <*> (o .:? "lastTickDirection")+ <*> (o .:? "lastChangePcnt")+ <*> (o .:? "bidPrice")+ <*> (o .:? "midPrice")+ <*> (o .:? "askPrice")+ <*> (o .:? "impactBidPrice")+ <*> (o .:? "impactMidPrice")+ <*> (o .:? "impactAskPrice")+ <*> (o .:? "hasLiquidity")+ <*> (o .:? "openInterest")+ <*> (o .:? "openValue")+ <*> (o .:? "fairMethod")+ <*> (o .:? "fairBasisRate")+ <*> (o .:? "fairBasis")+ <*> (o .:? "fairPrice")+ <*> (o .:? "markMethod")+ <*> (o .:? "markPrice")+ <*> (o .:? "indicativeTaxRate")+ <*> (o .:? "indicativeSettlePrice")+ <*> (o .:? "settledPrice")+ <*> (o .:? "timestamp")++-- | ToJSON Instrument+instance A.ToJSON Instrument where+ toJSON Instrument {..} =+ _omitNulls+ [ "symbol" .= instrumentSymbol+ , "rootSymbol" .= instrumentRootSymbol+ , "state" .= instrumentState+ , "typ" .= instrumentTyp+ , "listing" .= instrumentListing+ , "front" .= instrumentFront+ , "expiry" .= instrumentExpiry+ , "settle" .= instrumentSettle+ , "relistInterval" .= instrumentRelistInterval+ , "inverseLeg" .= instrumentInverseLeg+ , "sellLeg" .= instrumentSellLeg+ , "buyLeg" .= instrumentBuyLeg+ , "positionCurrency" .= instrumentPositionCurrency+ , "underlying" .= instrumentUnderlying+ , "quoteCurrency" .= instrumentQuoteCurrency+ , "underlyingSymbol" .= instrumentUnderlyingSymbol+ , "reference" .= instrumentReference+ , "referenceSymbol" .= instrumentReferenceSymbol+ , "calcInterval" .= instrumentCalcInterval+ , "publishInterval" .= instrumentPublishInterval+ , "publishTime" .= instrumentPublishTime+ , "maxOrderQty" .= instrumentMaxOrderQty+ , "maxPrice" .= instrumentMaxPrice+ , "lotSize" .= instrumentLotSize+ , "tickSize" .= instrumentTickSize+ , "multiplier" .= instrumentMultiplier+ , "settlCurrency" .= instrumentSettlCurrency+ , "underlyingToPositionMultiplier" .= instrumentUnderlyingToPositionMultiplier+ , "underlyingToSettleMultiplier" .= instrumentUnderlyingToSettleMultiplier+ , "quoteToSettleMultiplier" .= instrumentQuoteToSettleMultiplier+ , "isQuanto" .= instrumentIsQuanto+ , "isInverse" .= instrumentIsInverse+ , "initMargin" .= instrumentInitMargin+ , "maintMargin" .= instrumentMaintMargin+ , "riskLimit" .= instrumentRiskLimit+ , "riskStep" .= instrumentRiskStep+ , "limit" .= instrumentLimit+ , "capped" .= instrumentCapped+ , "taxed" .= instrumentTaxed+ , "deleverage" .= instrumentDeleverage+ , "makerFee" .= instrumentMakerFee+ , "takerFee" .= instrumentTakerFee+ , "settlementFee" .= instrumentSettlementFee+ , "insuranceFee" .= instrumentInsuranceFee+ , "fundingBaseSymbol" .= instrumentFundingBaseSymbol+ , "fundingQuoteSymbol" .= instrumentFundingQuoteSymbol+ , "fundingPremiumSymbol" .= instrumentFundingPremiumSymbol+ , "fundingTimestamp" .= instrumentFundingTimestamp+ , "fundingInterval" .= instrumentFundingInterval+ , "fundingRate" .= instrumentFundingRate+ , "indicativeFundingRate" .= instrumentIndicativeFundingRate+ , "rebalanceTimestamp" .= instrumentRebalanceTimestamp+ , "rebalanceInterval" .= instrumentRebalanceInterval+ , "openingTimestamp" .= instrumentOpeningTimestamp+ , "closingTimestamp" .= instrumentClosingTimestamp+ , "sessionInterval" .= instrumentSessionInterval+ , "prevClosePrice" .= instrumentPrevClosePrice+ , "limitDownPrice" .= instrumentLimitDownPrice+ , "limitUpPrice" .= instrumentLimitUpPrice+ , "bankruptLimitDownPrice" .= instrumentBankruptLimitDownPrice+ , "bankruptLimitUpPrice" .= instrumentBankruptLimitUpPrice+ , "prevTotalVolume" .= instrumentPrevTotalVolume+ , "totalVolume" .= instrumentTotalVolume+ , "volume" .= instrumentVolume+ , "volume24h" .= instrumentVolume24h+ , "prevTotalTurnover" .= instrumentPrevTotalTurnover+ , "totalTurnover" .= instrumentTotalTurnover+ , "turnover" .= instrumentTurnover+ , "turnover24h" .= instrumentTurnover24h+ , "prevPrice24h" .= instrumentPrevPrice24h+ , "vwap" .= instrumentVwap+ , "highPrice" .= instrumentHighPrice+ , "lowPrice" .= instrumentLowPrice+ , "lastPrice" .= instrumentLastPrice+ , "lastPriceProtected" .= instrumentLastPriceProtected+ , "lastTickDirection" .= instrumentLastTickDirection+ , "lastChangePcnt" .= instrumentLastChangePcnt+ , "bidPrice" .= instrumentBidPrice+ , "midPrice" .= instrumentMidPrice+ , "askPrice" .= instrumentAskPrice+ , "impactBidPrice" .= instrumentImpactBidPrice+ , "impactMidPrice" .= instrumentImpactMidPrice+ , "impactAskPrice" .= instrumentImpactAskPrice+ , "hasLiquidity" .= instrumentHasLiquidity+ , "openInterest" .= instrumentOpenInterest+ , "openValue" .= instrumentOpenValue+ , "fairMethod" .= instrumentFairMethod+ , "fairBasisRate" .= instrumentFairBasisRate+ , "fairBasis" .= instrumentFairBasis+ , "fairPrice" .= instrumentFairPrice+ , "markMethod" .= instrumentMarkMethod+ , "markPrice" .= instrumentMarkPrice+ , "indicativeTaxRate" .= instrumentIndicativeTaxRate+ , "indicativeSettlePrice" .= instrumentIndicativeSettlePrice+ , "settledPrice" .= instrumentSettledPrice+ , "timestamp" .= instrumentTimestamp+ ]+++-- | Construct a value of type 'Instrument' (by applying it's required fields, if any)+mkInstrument+ :: Text -- ^ 'instrumentSymbol' + -> Instrument+mkInstrument instrumentSymbol =+ Instrument+ { instrumentSymbol+ , instrumentRootSymbol = Nothing+ , instrumentState = Nothing+ , instrumentTyp = Nothing+ , instrumentListing = Nothing+ , instrumentFront = Nothing+ , instrumentExpiry = Nothing+ , instrumentSettle = Nothing+ , instrumentRelistInterval = Nothing+ , instrumentInverseLeg = Nothing+ , instrumentSellLeg = Nothing+ , instrumentBuyLeg = Nothing+ , instrumentPositionCurrency = Nothing+ , instrumentUnderlying = Nothing+ , instrumentQuoteCurrency = Nothing+ , instrumentUnderlyingSymbol = Nothing+ , instrumentReference = Nothing+ , instrumentReferenceSymbol = Nothing+ , instrumentCalcInterval = Nothing+ , instrumentPublishInterval = Nothing+ , instrumentPublishTime = Nothing+ , instrumentMaxOrderQty = Nothing+ , instrumentMaxPrice = Nothing+ , instrumentLotSize = Nothing+ , instrumentTickSize = Nothing+ , instrumentMultiplier = Nothing+ , instrumentSettlCurrency = Nothing+ , instrumentUnderlyingToPositionMultiplier = Nothing+ , instrumentUnderlyingToSettleMultiplier = Nothing+ , instrumentQuoteToSettleMultiplier = Nothing+ , instrumentIsQuanto = Nothing+ , instrumentIsInverse = Nothing+ , instrumentInitMargin = Nothing+ , instrumentMaintMargin = Nothing+ , instrumentRiskLimit = Nothing+ , instrumentRiskStep = Nothing+ , instrumentLimit = Nothing+ , instrumentCapped = Nothing+ , instrumentTaxed = Nothing+ , instrumentDeleverage = Nothing+ , instrumentMakerFee = Nothing+ , instrumentTakerFee = Nothing+ , instrumentSettlementFee = Nothing+ , instrumentInsuranceFee = Nothing+ , instrumentFundingBaseSymbol = Nothing+ , instrumentFundingQuoteSymbol = Nothing+ , instrumentFundingPremiumSymbol = Nothing+ , instrumentFundingTimestamp = Nothing+ , instrumentFundingInterval = Nothing+ , instrumentFundingRate = Nothing+ , instrumentIndicativeFundingRate = Nothing+ , instrumentRebalanceTimestamp = Nothing+ , instrumentRebalanceInterval = Nothing+ , instrumentOpeningTimestamp = Nothing+ , instrumentClosingTimestamp = Nothing+ , instrumentSessionInterval = Nothing+ , instrumentPrevClosePrice = Nothing+ , instrumentLimitDownPrice = Nothing+ , instrumentLimitUpPrice = Nothing+ , instrumentBankruptLimitDownPrice = Nothing+ , instrumentBankruptLimitUpPrice = Nothing+ , instrumentPrevTotalVolume = Nothing+ , instrumentTotalVolume = Nothing+ , instrumentVolume = Nothing+ , instrumentVolume24h = Nothing+ , instrumentPrevTotalTurnover = Nothing+ , instrumentTotalTurnover = Nothing+ , instrumentTurnover = Nothing+ , instrumentTurnover24h = Nothing+ , instrumentPrevPrice24h = Nothing+ , instrumentVwap = Nothing+ , instrumentHighPrice = Nothing+ , instrumentLowPrice = Nothing+ , instrumentLastPrice = Nothing+ , instrumentLastPriceProtected = Nothing+ , instrumentLastTickDirection = Nothing+ , instrumentLastChangePcnt = Nothing+ , instrumentBidPrice = Nothing+ , instrumentMidPrice = Nothing+ , instrumentAskPrice = Nothing+ , instrumentImpactBidPrice = Nothing+ , instrumentImpactMidPrice = Nothing+ , instrumentImpactAskPrice = Nothing+ , instrumentHasLiquidity = Nothing+ , instrumentOpenInterest = Nothing+ , instrumentOpenValue = Nothing+ , instrumentFairMethod = Nothing+ , instrumentFairBasisRate = Nothing+ , instrumentFairBasis = Nothing+ , instrumentFairPrice = Nothing+ , instrumentMarkMethod = Nothing+ , instrumentMarkPrice = Nothing+ , instrumentIndicativeTaxRate = Nothing+ , instrumentIndicativeSettlePrice = Nothing+ , instrumentSettledPrice = Nothing+ , instrumentTimestamp = Nothing+ }++-- ** InstrumentInterval+-- | InstrumentInterval+data InstrumentInterval = InstrumentInterval+ { instrumentIntervalIntervals :: !([Text]) -- ^ /Required/ "intervals"+ , instrumentIntervalSymbols :: !([Text]) -- ^ /Required/ "symbols"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON InstrumentInterval+instance A.FromJSON InstrumentInterval where+ parseJSON = A.withObject "InstrumentInterval" $ \o ->+ InstrumentInterval+ <$> (o .: "intervals")+ <*> (o .: "symbols")++-- | ToJSON InstrumentInterval+instance A.ToJSON InstrumentInterval where+ toJSON InstrumentInterval {..} =+ _omitNulls+ [ "intervals" .= instrumentIntervalIntervals+ , "symbols" .= instrumentIntervalSymbols+ ]+++-- | Construct a value of type 'InstrumentInterval' (by applying it's required fields, if any)+mkInstrumentInterval+ :: [Text] -- ^ 'instrumentIntervalIntervals' + -> [Text] -- ^ 'instrumentIntervalSymbols' + -> InstrumentInterval+mkInstrumentInterval instrumentIntervalIntervals instrumentIntervalSymbols =+ InstrumentInterval+ { instrumentIntervalIntervals+ , instrumentIntervalSymbols+ }++-- ** Insurance+-- | Insurance+-- Insurance Fund Data+data Insurance = Insurance+ { insuranceCurrency :: !(Text) -- ^ /Required/ "currency"+ , insuranceTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , insuranceWalletBalance :: !(Maybe Double) -- ^ "walletBalance"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Insurance+instance A.FromJSON Insurance where+ parseJSON = A.withObject "Insurance" $ \o ->+ Insurance+ <$> (o .: "currency")+ <*> (o .: "timestamp")+ <*> (o .:? "walletBalance")++-- | ToJSON Insurance+instance A.ToJSON Insurance where+ toJSON Insurance {..} =+ _omitNulls+ [ "currency" .= insuranceCurrency+ , "timestamp" .= insuranceTimestamp+ , "walletBalance" .= insuranceWalletBalance+ ]+++-- | Construct a value of type 'Insurance' (by applying it's required fields, if any)+mkInsurance+ :: Text -- ^ 'insuranceCurrency' + -> DateTime -- ^ 'insuranceTimestamp' + -> Insurance+mkInsurance insuranceCurrency insuranceTimestamp =+ Insurance+ { insuranceCurrency+ , insuranceTimestamp+ , insuranceWalletBalance = Nothing+ }++-- ** Leaderboard+-- | Leaderboard+-- Information on Top Users+data Leaderboard = Leaderboard+ { leaderboardName :: !(Text) -- ^ /Required/ "name"+ , leaderboardIsRealName :: !(Maybe Bool) -- ^ "isRealName"+ , leaderboardIsMe :: !(Maybe Bool) -- ^ "isMe"+ , leaderboardProfit :: !(Maybe Double) -- ^ "profit"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Leaderboard+instance A.FromJSON Leaderboard where+ parseJSON = A.withObject "Leaderboard" $ \o ->+ Leaderboard+ <$> (o .: "name")+ <*> (o .:? "isRealName")+ <*> (o .:? "isMe")+ <*> (o .:? "profit")++-- | ToJSON Leaderboard+instance A.ToJSON Leaderboard where+ toJSON Leaderboard {..} =+ _omitNulls+ [ "name" .= leaderboardName+ , "isRealName" .= leaderboardIsRealName+ , "isMe" .= leaderboardIsMe+ , "profit" .= leaderboardProfit+ ]+++-- | Construct a value of type 'Leaderboard' (by applying it's required fields, if any)+mkLeaderboard+ :: Text -- ^ 'leaderboardName' + -> Leaderboard+mkLeaderboard leaderboardName =+ Leaderboard+ { leaderboardName+ , leaderboardIsRealName = Nothing+ , leaderboardIsMe = Nothing+ , leaderboardProfit = Nothing+ }++-- ** Liquidation+-- | Liquidation+-- Active Liquidations+data Liquidation = Liquidation+ { liquidationOrderId :: !(Text) -- ^ /Required/ "orderID"+ , liquidationSymbol :: !(Maybe Text) -- ^ "symbol"+ , liquidationSide :: !(Maybe Text) -- ^ "side"+ , liquidationPrice :: !(Maybe Double) -- ^ "price"+ , liquidationLeavesQty :: !(Maybe Double) -- ^ "leavesQty"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Liquidation+instance A.FromJSON Liquidation where+ parseJSON = A.withObject "Liquidation" $ \o ->+ Liquidation+ <$> (o .: "orderID")+ <*> (o .:? "symbol")+ <*> (o .:? "side")+ <*> (o .:? "price")+ <*> (o .:? "leavesQty")++-- | ToJSON Liquidation+instance A.ToJSON Liquidation where+ toJSON Liquidation {..} =+ _omitNulls+ [ "orderID" .= liquidationOrderId+ , "symbol" .= liquidationSymbol+ , "side" .= liquidationSide+ , "price" .= liquidationPrice+ , "leavesQty" .= liquidationLeavesQty+ ]+++-- | Construct a value of type 'Liquidation' (by applying it's required fields, if any)+mkLiquidation+ :: Text -- ^ 'liquidationOrderId' + -> Liquidation+mkLiquidation liquidationOrderId =+ Liquidation+ { liquidationOrderId+ , liquidationSymbol = Nothing+ , liquidationSide = Nothing+ , liquidationPrice = Nothing+ , liquidationLeavesQty = Nothing+ }++-- ** Margin+-- | Margin+data Margin = Margin+ { marginAccount :: !(Double) -- ^ /Required/ "account"+ , marginCurrency :: !(Text) -- ^ /Required/ "currency"+ , marginRiskLimit :: !(Maybe Double) -- ^ "riskLimit"+ , marginPrevState :: !(Maybe Text) -- ^ "prevState"+ , marginState :: !(Maybe Text) -- ^ "state"+ , marginAction :: !(Maybe Text) -- ^ "action"+ , marginAmount :: !(Maybe Double) -- ^ "amount"+ , marginPendingCredit :: !(Maybe Double) -- ^ "pendingCredit"+ , marginPendingDebit :: !(Maybe Double) -- ^ "pendingDebit"+ , marginConfirmedDebit :: !(Maybe Double) -- ^ "confirmedDebit"+ , marginPrevRealisedPnl :: !(Maybe Double) -- ^ "prevRealisedPnl"+ , marginPrevUnrealisedPnl :: !(Maybe Double) -- ^ "prevUnrealisedPnl"+ , marginGrossComm :: !(Maybe Double) -- ^ "grossComm"+ , marginGrossOpenCost :: !(Maybe Double) -- ^ "grossOpenCost"+ , marginGrossOpenPremium :: !(Maybe Double) -- ^ "grossOpenPremium"+ , marginGrossExecCost :: !(Maybe Double) -- ^ "grossExecCost"+ , marginGrossMarkValue :: !(Maybe Double) -- ^ "grossMarkValue"+ , marginRiskValue :: !(Maybe Double) -- ^ "riskValue"+ , marginTaxableMargin :: !(Maybe Double) -- ^ "taxableMargin"+ , marginInitMargin :: !(Maybe Double) -- ^ "initMargin"+ , marginMaintMargin :: !(Maybe Double) -- ^ "maintMargin"+ , marginSessionMargin :: !(Maybe Double) -- ^ "sessionMargin"+ , marginTargetExcessMargin :: !(Maybe Double) -- ^ "targetExcessMargin"+ , marginVarMargin :: !(Maybe Double) -- ^ "varMargin"+ , marginRealisedPnl :: !(Maybe Double) -- ^ "realisedPnl"+ , marginUnrealisedPnl :: !(Maybe Double) -- ^ "unrealisedPnl"+ , marginIndicativeTax :: !(Maybe Double) -- ^ "indicativeTax"+ , marginUnrealisedProfit :: !(Maybe Double) -- ^ "unrealisedProfit"+ , marginSyntheticMargin :: !(Maybe Double) -- ^ "syntheticMargin"+ , marginWalletBalance :: !(Maybe Double) -- ^ "walletBalance"+ , marginMarginBalance :: !(Maybe Double) -- ^ "marginBalance"+ , marginMarginBalancePcnt :: !(Maybe Double) -- ^ "marginBalancePcnt"+ , marginMarginLeverage :: !(Maybe Double) -- ^ "marginLeverage"+ , marginMarginUsedPcnt :: !(Maybe Double) -- ^ "marginUsedPcnt"+ , marginExcessMargin :: !(Maybe Double) -- ^ "excessMargin"+ , marginExcessMarginPcnt :: !(Maybe Double) -- ^ "excessMarginPcnt"+ , marginAvailableMargin :: !(Maybe Double) -- ^ "availableMargin"+ , marginWithdrawableMargin :: !(Maybe Double) -- ^ "withdrawableMargin"+ , marginTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ , marginGrossLastValue :: !(Maybe Double) -- ^ "grossLastValue"+ , marginCommission :: !(Maybe Double) -- ^ "commission"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Margin+instance A.FromJSON Margin where+ parseJSON = A.withObject "Margin" $ \o ->+ Margin+ <$> (o .: "account")+ <*> (o .: "currency")+ <*> (o .:? "riskLimit")+ <*> (o .:? "prevState")+ <*> (o .:? "state")+ <*> (o .:? "action")+ <*> (o .:? "amount")+ <*> (o .:? "pendingCredit")+ <*> (o .:? "pendingDebit")+ <*> (o .:? "confirmedDebit")+ <*> (o .:? "prevRealisedPnl")+ <*> (o .:? "prevUnrealisedPnl")+ <*> (o .:? "grossComm")+ <*> (o .:? "grossOpenCost")+ <*> (o .:? "grossOpenPremium")+ <*> (o .:? "grossExecCost")+ <*> (o .:? "grossMarkValue")+ <*> (o .:? "riskValue")+ <*> (o .:? "taxableMargin")+ <*> (o .:? "initMargin")+ <*> (o .:? "maintMargin")+ <*> (o .:? "sessionMargin")+ <*> (o .:? "targetExcessMargin")+ <*> (o .:? "varMargin")+ <*> (o .:? "realisedPnl")+ <*> (o .:? "unrealisedPnl")+ <*> (o .:? "indicativeTax")+ <*> (o .:? "unrealisedProfit")+ <*> (o .:? "syntheticMargin")+ <*> (o .:? "walletBalance")+ <*> (o .:? "marginBalance")+ <*> (o .:? "marginBalancePcnt")+ <*> (o .:? "marginLeverage")+ <*> (o .:? "marginUsedPcnt")+ <*> (o .:? "excessMargin")+ <*> (o .:? "excessMarginPcnt")+ <*> (o .:? "availableMargin")+ <*> (o .:? "withdrawableMargin")+ <*> (o .:? "timestamp")+ <*> (o .:? "grossLastValue")+ <*> (o .:? "commission")++-- | ToJSON Margin+instance A.ToJSON Margin where+ toJSON Margin {..} =+ _omitNulls+ [ "account" .= marginAccount+ , "currency" .= marginCurrency+ , "riskLimit" .= marginRiskLimit+ , "prevState" .= marginPrevState+ , "state" .= marginState+ , "action" .= marginAction+ , "amount" .= marginAmount+ , "pendingCredit" .= marginPendingCredit+ , "pendingDebit" .= marginPendingDebit+ , "confirmedDebit" .= marginConfirmedDebit+ , "prevRealisedPnl" .= marginPrevRealisedPnl+ , "prevUnrealisedPnl" .= marginPrevUnrealisedPnl+ , "grossComm" .= marginGrossComm+ , "grossOpenCost" .= marginGrossOpenCost+ , "grossOpenPremium" .= marginGrossOpenPremium+ , "grossExecCost" .= marginGrossExecCost+ , "grossMarkValue" .= marginGrossMarkValue+ , "riskValue" .= marginRiskValue+ , "taxableMargin" .= marginTaxableMargin+ , "initMargin" .= marginInitMargin+ , "maintMargin" .= marginMaintMargin+ , "sessionMargin" .= marginSessionMargin+ , "targetExcessMargin" .= marginTargetExcessMargin+ , "varMargin" .= marginVarMargin+ , "realisedPnl" .= marginRealisedPnl+ , "unrealisedPnl" .= marginUnrealisedPnl+ , "indicativeTax" .= marginIndicativeTax+ , "unrealisedProfit" .= marginUnrealisedProfit+ , "syntheticMargin" .= marginSyntheticMargin+ , "walletBalance" .= marginWalletBalance+ , "marginBalance" .= marginMarginBalance+ , "marginBalancePcnt" .= marginMarginBalancePcnt+ , "marginLeverage" .= marginMarginLeverage+ , "marginUsedPcnt" .= marginMarginUsedPcnt+ , "excessMargin" .= marginExcessMargin+ , "excessMarginPcnt" .= marginExcessMarginPcnt+ , "availableMargin" .= marginAvailableMargin+ , "withdrawableMargin" .= marginWithdrawableMargin+ , "timestamp" .= marginTimestamp+ , "grossLastValue" .= marginGrossLastValue+ , "commission" .= marginCommission+ ]+++-- | Construct a value of type 'Margin' (by applying it's required fields, if any)+mkMargin+ :: Double -- ^ 'marginAccount' + -> Text -- ^ 'marginCurrency' + -> Margin+mkMargin marginAccount marginCurrency =+ Margin+ { marginAccount+ , marginCurrency+ , marginRiskLimit = Nothing+ , marginPrevState = Nothing+ , marginState = Nothing+ , marginAction = Nothing+ , marginAmount = Nothing+ , marginPendingCredit = Nothing+ , marginPendingDebit = Nothing+ , marginConfirmedDebit = Nothing+ , marginPrevRealisedPnl = Nothing+ , marginPrevUnrealisedPnl = Nothing+ , marginGrossComm = Nothing+ , marginGrossOpenCost = Nothing+ , marginGrossOpenPremium = Nothing+ , marginGrossExecCost = Nothing+ , marginGrossMarkValue = Nothing+ , marginRiskValue = Nothing+ , marginTaxableMargin = Nothing+ , marginInitMargin = Nothing+ , marginMaintMargin = Nothing+ , marginSessionMargin = Nothing+ , marginTargetExcessMargin = Nothing+ , marginVarMargin = Nothing+ , marginRealisedPnl = Nothing+ , marginUnrealisedPnl = Nothing+ , marginIndicativeTax = Nothing+ , marginUnrealisedProfit = Nothing+ , marginSyntheticMargin = Nothing+ , marginWalletBalance = Nothing+ , marginMarginBalance = Nothing+ , marginMarginBalancePcnt = Nothing+ , marginMarginLeverage = Nothing+ , marginMarginUsedPcnt = Nothing+ , marginExcessMargin = Nothing+ , marginExcessMarginPcnt = Nothing+ , marginAvailableMargin = Nothing+ , marginWithdrawableMargin = Nothing+ , marginTimestamp = Nothing+ , marginGrossLastValue = Nothing+ , marginCommission = Nothing+ }++-- ** Notification+-- | Notification+-- Account Notifications+data Notification = Notification+ { notificationId :: !(Maybe Double) -- ^ "id"+ , notificationDate :: !(DateTime) -- ^ /Required/ "date"+ , notificationTitle :: !(Text) -- ^ /Required/ "title"+ , notificationBody :: !(Text) -- ^ /Required/ "body"+ , notificationTtl :: !(Double) -- ^ /Required/ "ttl"+ , notificationType :: !(Maybe E'Type) -- ^ "type"+ , notificationClosable :: !(Maybe Bool) -- ^ "closable"+ , notificationPersist :: !(Maybe Bool) -- ^ "persist"+ , notificationWaitForVisibility :: !(Maybe Bool) -- ^ "waitForVisibility"+ , notificationSound :: !(Maybe Text) -- ^ "sound"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Notification+instance A.FromJSON Notification where+ parseJSON = A.withObject "Notification" $ \o ->+ Notification+ <$> (o .:? "id")+ <*> (o .: "date")+ <*> (o .: "title")+ <*> (o .: "body")+ <*> (o .: "ttl")+ <*> (o .:? "type")+ <*> (o .:? "closable")+ <*> (o .:? "persist")+ <*> (o .:? "waitForVisibility")+ <*> (o .:? "sound")++-- | ToJSON Notification+instance A.ToJSON Notification where+ toJSON Notification {..} =+ _omitNulls+ [ "id" .= notificationId+ , "date" .= notificationDate+ , "title" .= notificationTitle+ , "body" .= notificationBody+ , "ttl" .= notificationTtl+ , "type" .= notificationType+ , "closable" .= notificationClosable+ , "persist" .= notificationPersist+ , "waitForVisibility" .= notificationWaitForVisibility+ , "sound" .= notificationSound+ ]+++-- | Construct a value of type 'Notification' (by applying it's required fields, if any)+mkNotification+ :: DateTime -- ^ 'notificationDate' + -> Text -- ^ 'notificationTitle' + -> Text -- ^ 'notificationBody' + -> Double -- ^ 'notificationTtl' + -> Notification+mkNotification notificationDate notificationTitle notificationBody notificationTtl =+ Notification+ { notificationId = Nothing+ , notificationDate+ , notificationTitle+ , notificationBody+ , notificationTtl+ , notificationType = Nothing+ , notificationClosable = Nothing+ , notificationPersist = Nothing+ , notificationWaitForVisibility = Nothing+ , notificationSound = Nothing+ }++-- ** Order+-- | Order+-- Placement, Cancellation, Amending, and History+data Order = Order+ { orderOrderId :: !(Text) -- ^ /Required/ "orderID"+ , orderClOrdId :: !(Maybe Text) -- ^ "clOrdID"+ , orderClOrdLinkId :: !(Maybe Text) -- ^ "clOrdLinkID"+ , orderAccount :: !(Maybe Double) -- ^ "account"+ , orderSymbol :: !(Maybe Text) -- ^ "symbol"+ , orderSide :: !(Maybe Text) -- ^ "side"+ , orderSimpleOrderQty :: !(Maybe Double) -- ^ "simpleOrderQty"+ , orderOrderQty :: !(Maybe Double) -- ^ "orderQty"+ , orderPrice :: !(Maybe Double) -- ^ "price"+ , orderDisplayQty :: !(Maybe Double) -- ^ "displayQty"+ , orderStopPx :: !(Maybe Double) -- ^ "stopPx"+ , orderPegOffsetValue :: !(Maybe Double) -- ^ "pegOffsetValue"+ , orderPegPriceType :: !(Maybe Text) -- ^ "pegPriceType"+ , orderCurrency :: !(Maybe Text) -- ^ "currency"+ , orderSettlCurrency :: !(Maybe Text) -- ^ "settlCurrency"+ , orderOrdType :: !(Maybe Text) -- ^ "ordType"+ , orderTimeInForce :: !(Maybe Text) -- ^ "timeInForce"+ , orderExecInst :: !(Maybe Text) -- ^ "execInst"+ , orderContingencyType :: !(Maybe Text) -- ^ "contingencyType"+ , orderExDestination :: !(Maybe Text) -- ^ "exDestination"+ , orderOrdStatus :: !(Maybe Text) -- ^ "ordStatus"+ , orderTriggered :: !(Maybe Text) -- ^ "triggered"+ , orderWorkingIndicator :: !(Maybe Bool) -- ^ "workingIndicator"+ , orderOrdRejReason :: !(Maybe Text) -- ^ "ordRejReason"+ , orderSimpleLeavesQty :: !(Maybe Double) -- ^ "simpleLeavesQty"+ , orderLeavesQty :: !(Maybe Double) -- ^ "leavesQty"+ , orderSimpleCumQty :: !(Maybe Double) -- ^ "simpleCumQty"+ , orderCumQty :: !(Maybe Double) -- ^ "cumQty"+ , orderAvgPx :: !(Maybe Double) -- ^ "avgPx"+ , orderMultiLegReportingType :: !(Maybe Text) -- ^ "multiLegReportingType"+ , orderText :: !(Maybe Text) -- ^ "text"+ , orderTransactTime :: !(Maybe DateTime) -- ^ "transactTime"+ , orderTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Order+instance A.FromJSON Order where+ parseJSON = A.withObject "Order" $ \o ->+ Order+ <$> (o .: "orderID")+ <*> (o .:? "clOrdID")+ <*> (o .:? "clOrdLinkID")+ <*> (o .:? "account")+ <*> (o .:? "symbol")+ <*> (o .:? "side")+ <*> (o .:? "simpleOrderQty")+ <*> (o .:? "orderQty")+ <*> (o .:? "price")+ <*> (o .:? "displayQty")+ <*> (o .:? "stopPx")+ <*> (o .:? "pegOffsetValue")+ <*> (o .:? "pegPriceType")+ <*> (o .:? "currency")+ <*> (o .:? "settlCurrency")+ <*> (o .:? "ordType")+ <*> (o .:? "timeInForce")+ <*> (o .:? "execInst")+ <*> (o .:? "contingencyType")+ <*> (o .:? "exDestination")+ <*> (o .:? "ordStatus")+ <*> (o .:? "triggered")+ <*> (o .:? "workingIndicator")+ <*> (o .:? "ordRejReason")+ <*> (o .:? "simpleLeavesQty")+ <*> (o .:? "leavesQty")+ <*> (o .:? "simpleCumQty")+ <*> (o .:? "cumQty")+ <*> (o .:? "avgPx")+ <*> (o .:? "multiLegReportingType")+ <*> (o .:? "text")+ <*> (o .:? "transactTime")+ <*> (o .:? "timestamp")++-- | ToJSON Order+instance A.ToJSON Order where+ toJSON Order {..} =+ _omitNulls+ [ "orderID" .= orderOrderId+ , "clOrdID" .= orderClOrdId+ , "clOrdLinkID" .= orderClOrdLinkId+ , "account" .= orderAccount+ , "symbol" .= orderSymbol+ , "side" .= orderSide+ , "simpleOrderQty" .= orderSimpleOrderQty+ , "orderQty" .= orderOrderQty+ , "price" .= orderPrice+ , "displayQty" .= orderDisplayQty+ , "stopPx" .= orderStopPx+ , "pegOffsetValue" .= orderPegOffsetValue+ , "pegPriceType" .= orderPegPriceType+ , "currency" .= orderCurrency+ , "settlCurrency" .= orderSettlCurrency+ , "ordType" .= orderOrdType+ , "timeInForce" .= orderTimeInForce+ , "execInst" .= orderExecInst+ , "contingencyType" .= orderContingencyType+ , "exDestination" .= orderExDestination+ , "ordStatus" .= orderOrdStatus+ , "triggered" .= orderTriggered+ , "workingIndicator" .= orderWorkingIndicator+ , "ordRejReason" .= orderOrdRejReason+ , "simpleLeavesQty" .= orderSimpleLeavesQty+ , "leavesQty" .= orderLeavesQty+ , "simpleCumQty" .= orderSimpleCumQty+ , "cumQty" .= orderCumQty+ , "avgPx" .= orderAvgPx+ , "multiLegReportingType" .= orderMultiLegReportingType+ , "text" .= orderText+ , "transactTime" .= orderTransactTime+ , "timestamp" .= orderTimestamp+ ]+++-- | Construct a value of type 'Order' (by applying it's required fields, if any)+mkOrder+ :: Text -- ^ 'orderOrderId' + -> Order+mkOrder orderOrderId =+ Order+ { orderOrderId+ , orderClOrdId = Nothing+ , orderClOrdLinkId = Nothing+ , orderAccount = Nothing+ , orderSymbol = Nothing+ , orderSide = Nothing+ , orderSimpleOrderQty = Nothing+ , orderOrderQty = Nothing+ , orderPrice = Nothing+ , orderDisplayQty = Nothing+ , orderStopPx = Nothing+ , orderPegOffsetValue = Nothing+ , orderPegPriceType = Nothing+ , orderCurrency = Nothing+ , orderSettlCurrency = Nothing+ , orderOrdType = Nothing+ , orderTimeInForce = Nothing+ , orderExecInst = Nothing+ , orderContingencyType = Nothing+ , orderExDestination = Nothing+ , orderOrdStatus = Nothing+ , orderTriggered = Nothing+ , orderWorkingIndicator = Nothing+ , orderOrdRejReason = Nothing+ , orderSimpleLeavesQty = Nothing+ , orderLeavesQty = Nothing+ , orderSimpleCumQty = Nothing+ , orderCumQty = Nothing+ , orderAvgPx = Nothing+ , orderMultiLegReportingType = Nothing+ , orderText = Nothing+ , orderTransactTime = Nothing+ , orderTimestamp = Nothing+ }++-- ** OrderBook+-- | OrderBook+-- Level 2 Book Data+data OrderBook = OrderBook+ { orderBookSymbol :: !(Text) -- ^ /Required/ "symbol"+ , orderBookLevel :: !(Double) -- ^ /Required/ "level"+ , orderBookBidSize :: !(Maybe Double) -- ^ "bidSize"+ , orderBookBidPrice :: !(Maybe Double) -- ^ "bidPrice"+ , orderBookAskPrice :: !(Maybe Double) -- ^ "askPrice"+ , orderBookAskSize :: !(Maybe Double) -- ^ "askSize"+ , orderBookTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON OrderBook+instance A.FromJSON OrderBook where+ parseJSON = A.withObject "OrderBook" $ \o ->+ OrderBook+ <$> (o .: "symbol")+ <*> (o .: "level")+ <*> (o .:? "bidSize")+ <*> (o .:? "bidPrice")+ <*> (o .:? "askPrice")+ <*> (o .:? "askSize")+ <*> (o .:? "timestamp")++-- | ToJSON OrderBook+instance A.ToJSON OrderBook where+ toJSON OrderBook {..} =+ _omitNulls+ [ "symbol" .= orderBookSymbol+ , "level" .= orderBookLevel+ , "bidSize" .= orderBookBidSize+ , "bidPrice" .= orderBookBidPrice+ , "askPrice" .= orderBookAskPrice+ , "askSize" .= orderBookAskSize+ , "timestamp" .= orderBookTimestamp+ ]+++-- | Construct a value of type 'OrderBook' (by applying it's required fields, if any)+mkOrderBook+ :: Text -- ^ 'orderBookSymbol' + -> Double -- ^ 'orderBookLevel' + -> OrderBook+mkOrderBook orderBookSymbol orderBookLevel =+ OrderBook+ { orderBookSymbol+ , orderBookLevel+ , orderBookBidSize = Nothing+ , orderBookBidPrice = Nothing+ , orderBookAskPrice = Nothing+ , orderBookAskSize = Nothing+ , orderBookTimestamp = Nothing+ }++-- ** OrderBookL2+-- | OrderBookL2+data OrderBookL2 = OrderBookL2+ { orderBookL2Symbol :: !(Text) -- ^ /Required/ "symbol"+ , orderBookL2Id :: !(Double) -- ^ /Required/ "id"+ , orderBookL2Side :: !(Text) -- ^ /Required/ "side"+ , orderBookL2Size :: !(Maybe Double) -- ^ "size"+ , orderBookL2Price :: !(Maybe Double) -- ^ "price"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON OrderBookL2+instance A.FromJSON OrderBookL2 where+ parseJSON = A.withObject "OrderBookL2" $ \o ->+ OrderBookL2+ <$> (o .: "symbol")+ <*> (o .: "id")+ <*> (o .: "side")+ <*> (o .:? "size")+ <*> (o .:? "price")++-- | ToJSON OrderBookL2+instance A.ToJSON OrderBookL2 where+ toJSON OrderBookL2 {..} =+ _omitNulls+ [ "symbol" .= orderBookL2Symbol+ , "id" .= orderBookL2Id+ , "side" .= orderBookL2Side+ , "size" .= orderBookL2Size+ , "price" .= orderBookL2Price+ ]+++-- | Construct a value of type 'OrderBookL2' (by applying it's required fields, if any)+mkOrderBookL2+ :: Text -- ^ 'orderBookL2Symbol' + -> Double -- ^ 'orderBookL2Id' + -> Text -- ^ 'orderBookL2Side' + -> OrderBookL2+mkOrderBookL2 orderBookL2Symbol orderBookL2Id orderBookL2Side =+ OrderBookL2+ { orderBookL2Symbol+ , orderBookL2Id+ , orderBookL2Side+ , orderBookL2Size = Nothing+ , orderBookL2Price = Nothing+ }++-- ** Position+-- | Position+-- Summary of Open and Closed Positions+data Position = Position+ { positionAccount :: !(Double) -- ^ /Required/ "account"+ , positionSymbol :: !(Text) -- ^ /Required/ "symbol"+ , positionCurrency :: !(Text) -- ^ /Required/ "currency"+ , positionUnderlying :: !(Maybe Text) -- ^ "underlying"+ , positionQuoteCurrency :: !(Maybe Text) -- ^ "quoteCurrency"+ , positionCommission :: !(Maybe Double) -- ^ "commission"+ , positionInitMarginReq :: !(Maybe Double) -- ^ "initMarginReq"+ , positionMaintMarginReq :: !(Maybe Double) -- ^ "maintMarginReq"+ , positionRiskLimit :: !(Maybe Double) -- ^ "riskLimit"+ , positionLeverage :: !(Maybe Double) -- ^ "leverage"+ , positionCrossMargin :: !(Maybe Bool) -- ^ "crossMargin"+ , positionDeleveragePercentile :: !(Maybe Double) -- ^ "deleveragePercentile"+ , positionRebalancedPnl :: !(Maybe Double) -- ^ "rebalancedPnl"+ , positionPrevRealisedPnl :: !(Maybe Double) -- ^ "prevRealisedPnl"+ , positionPrevUnrealisedPnl :: !(Maybe Double) -- ^ "prevUnrealisedPnl"+ , positionPrevClosePrice :: !(Maybe Double) -- ^ "prevClosePrice"+ , positionOpeningTimestamp :: !(Maybe DateTime) -- ^ "openingTimestamp"+ , positionOpeningQty :: !(Maybe Double) -- ^ "openingQty"+ , positionOpeningCost :: !(Maybe Double) -- ^ "openingCost"+ , positionOpeningComm :: !(Maybe Double) -- ^ "openingComm"+ , positionOpenOrderBuyQty :: !(Maybe Double) -- ^ "openOrderBuyQty"+ , positionOpenOrderBuyCost :: !(Maybe Double) -- ^ "openOrderBuyCost"+ , positionOpenOrderBuyPremium :: !(Maybe Double) -- ^ "openOrderBuyPremium"+ , positionOpenOrderSellQty :: !(Maybe Double) -- ^ "openOrderSellQty"+ , positionOpenOrderSellCost :: !(Maybe Double) -- ^ "openOrderSellCost"+ , positionOpenOrderSellPremium :: !(Maybe Double) -- ^ "openOrderSellPremium"+ , positionExecBuyQty :: !(Maybe Double) -- ^ "execBuyQty"+ , positionExecBuyCost :: !(Maybe Double) -- ^ "execBuyCost"+ , positionExecSellQty :: !(Maybe Double) -- ^ "execSellQty"+ , positionExecSellCost :: !(Maybe Double) -- ^ "execSellCost"+ , positionExecQty :: !(Maybe Double) -- ^ "execQty"+ , positionExecCost :: !(Maybe Double) -- ^ "execCost"+ , positionExecComm :: !(Maybe Double) -- ^ "execComm"+ , positionCurrentTimestamp :: !(Maybe DateTime) -- ^ "currentTimestamp"+ , positionCurrentQty :: !(Maybe Double) -- ^ "currentQty"+ , positionCurrentCost :: !(Maybe Double) -- ^ "currentCost"+ , positionCurrentComm :: !(Maybe Double) -- ^ "currentComm"+ , positionRealisedCost :: !(Maybe Double) -- ^ "realisedCost"+ , positionUnrealisedCost :: !(Maybe Double) -- ^ "unrealisedCost"+ , positionGrossOpenCost :: !(Maybe Double) -- ^ "grossOpenCost"+ , positionGrossOpenPremium :: !(Maybe Double) -- ^ "grossOpenPremium"+ , positionGrossExecCost :: !(Maybe Double) -- ^ "grossExecCost"+ , positionIsOpen :: !(Maybe Bool) -- ^ "isOpen"+ , positionMarkPrice :: !(Maybe Double) -- ^ "markPrice"+ , positionMarkValue :: !(Maybe Double) -- ^ "markValue"+ , positionRiskValue :: !(Maybe Double) -- ^ "riskValue"+ , positionHomeNotional :: !(Maybe Double) -- ^ "homeNotional"+ , positionForeignNotional :: !(Maybe Double) -- ^ "foreignNotional"+ , positionPosState :: !(Maybe Text) -- ^ "posState"+ , positionPosCost :: !(Maybe Double) -- ^ "posCost"+ , positionPosCost2 :: !(Maybe Double) -- ^ "posCost2"+ , positionPosCross :: !(Maybe Double) -- ^ "posCross"+ , positionPosInit :: !(Maybe Double) -- ^ "posInit"+ , positionPosComm :: !(Maybe Double) -- ^ "posComm"+ , positionPosLoss :: !(Maybe Double) -- ^ "posLoss"+ , positionPosMargin :: !(Maybe Double) -- ^ "posMargin"+ , positionPosMaint :: !(Maybe Double) -- ^ "posMaint"+ , positionPosAllowance :: !(Maybe Double) -- ^ "posAllowance"+ , positionTaxableMargin :: !(Maybe Double) -- ^ "taxableMargin"+ , positionInitMargin :: !(Maybe Double) -- ^ "initMargin"+ , positionMaintMargin :: !(Maybe Double) -- ^ "maintMargin"+ , positionSessionMargin :: !(Maybe Double) -- ^ "sessionMargin"+ , positionTargetExcessMargin :: !(Maybe Double) -- ^ "targetExcessMargin"+ , positionVarMargin :: !(Maybe Double) -- ^ "varMargin"+ , positionRealisedGrossPnl :: !(Maybe Double) -- ^ "realisedGrossPnl"+ , positionRealisedTax :: !(Maybe Double) -- ^ "realisedTax"+ , positionRealisedPnl :: !(Maybe Double) -- ^ "realisedPnl"+ , positionUnrealisedGrossPnl :: !(Maybe Double) -- ^ "unrealisedGrossPnl"+ , positionLongBankrupt :: !(Maybe Double) -- ^ "longBankrupt"+ , positionShortBankrupt :: !(Maybe Double) -- ^ "shortBankrupt"+ , positionTaxBase :: !(Maybe Double) -- ^ "taxBase"+ , positionIndicativeTaxRate :: !(Maybe Double) -- ^ "indicativeTaxRate"+ , positionIndicativeTax :: !(Maybe Double) -- ^ "indicativeTax"+ , positionUnrealisedTax :: !(Maybe Double) -- ^ "unrealisedTax"+ , positionUnrealisedPnl :: !(Maybe Double) -- ^ "unrealisedPnl"+ , positionUnrealisedPnlPcnt :: !(Maybe Double) -- ^ "unrealisedPnlPcnt"+ , positionUnrealisedRoePcnt :: !(Maybe Double) -- ^ "unrealisedRoePcnt"+ , positionSimpleQty :: !(Maybe Double) -- ^ "simpleQty"+ , positionSimpleCost :: !(Maybe Double) -- ^ "simpleCost"+ , positionSimpleValue :: !(Maybe Double) -- ^ "simpleValue"+ , positionSimplePnl :: !(Maybe Double) -- ^ "simplePnl"+ , positionSimplePnlPcnt :: !(Maybe Double) -- ^ "simplePnlPcnt"+ , positionAvgCostPrice :: !(Maybe Double) -- ^ "avgCostPrice"+ , positionAvgEntryPrice :: !(Maybe Double) -- ^ "avgEntryPrice"+ , positionBreakEvenPrice :: !(Maybe Double) -- ^ "breakEvenPrice"+ , positionMarginCallPrice :: !(Maybe Double) -- ^ "marginCallPrice"+ , positionLiquidationPrice :: !(Maybe Double) -- ^ "liquidationPrice"+ , positionBankruptPrice :: !(Maybe Double) -- ^ "bankruptPrice"+ , positionTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ , positionLastPrice :: !(Maybe Double) -- ^ "lastPrice"+ , positionLastValue :: !(Maybe Double) -- ^ "lastValue"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Position+instance A.FromJSON Position where+ parseJSON = A.withObject "Position" $ \o ->+ Position+ <$> (o .: "account")+ <*> (o .: "symbol")+ <*> (o .: "currency")+ <*> (o .:? "underlying")+ <*> (o .:? "quoteCurrency")+ <*> (o .:? "commission")+ <*> (o .:? "initMarginReq")+ <*> (o .:? "maintMarginReq")+ <*> (o .:? "riskLimit")+ <*> (o .:? "leverage")+ <*> (o .:? "crossMargin")+ <*> (o .:? "deleveragePercentile")+ <*> (o .:? "rebalancedPnl")+ <*> (o .:? "prevRealisedPnl")+ <*> (o .:? "prevUnrealisedPnl")+ <*> (o .:? "prevClosePrice")+ <*> (o .:? "openingTimestamp")+ <*> (o .:? "openingQty")+ <*> (o .:? "openingCost")+ <*> (o .:? "openingComm")+ <*> (o .:? "openOrderBuyQty")+ <*> (o .:? "openOrderBuyCost")+ <*> (o .:? "openOrderBuyPremium")+ <*> (o .:? "openOrderSellQty")+ <*> (o .:? "openOrderSellCost")+ <*> (o .:? "openOrderSellPremium")+ <*> (o .:? "execBuyQty")+ <*> (o .:? "execBuyCost")+ <*> (o .:? "execSellQty")+ <*> (o .:? "execSellCost")+ <*> (o .:? "execQty")+ <*> (o .:? "execCost")+ <*> (o .:? "execComm")+ <*> (o .:? "currentTimestamp")+ <*> (o .:? "currentQty")+ <*> (o .:? "currentCost")+ <*> (o .:? "currentComm")+ <*> (o .:? "realisedCost")+ <*> (o .:? "unrealisedCost")+ <*> (o .:? "grossOpenCost")+ <*> (o .:? "grossOpenPremium")+ <*> (o .:? "grossExecCost")+ <*> (o .:? "isOpen")+ <*> (o .:? "markPrice")+ <*> (o .:? "markValue")+ <*> (o .:? "riskValue")+ <*> (o .:? "homeNotional")+ <*> (o .:? "foreignNotional")+ <*> (o .:? "posState")+ <*> (o .:? "posCost")+ <*> (o .:? "posCost2")+ <*> (o .:? "posCross")+ <*> (o .:? "posInit")+ <*> (o .:? "posComm")+ <*> (o .:? "posLoss")+ <*> (o .:? "posMargin")+ <*> (o .:? "posMaint")+ <*> (o .:? "posAllowance")+ <*> (o .:? "taxableMargin")+ <*> (o .:? "initMargin")+ <*> (o .:? "maintMargin")+ <*> (o .:? "sessionMargin")+ <*> (o .:? "targetExcessMargin")+ <*> (o .:? "varMargin")+ <*> (o .:? "realisedGrossPnl")+ <*> (o .:? "realisedTax")+ <*> (o .:? "realisedPnl")+ <*> (o .:? "unrealisedGrossPnl")+ <*> (o .:? "longBankrupt")+ <*> (o .:? "shortBankrupt")+ <*> (o .:? "taxBase")+ <*> (o .:? "indicativeTaxRate")+ <*> (o .:? "indicativeTax")+ <*> (o .:? "unrealisedTax")+ <*> (o .:? "unrealisedPnl")+ <*> (o .:? "unrealisedPnlPcnt")+ <*> (o .:? "unrealisedRoePcnt")+ <*> (o .:? "simpleQty")+ <*> (o .:? "simpleCost")+ <*> (o .:? "simpleValue")+ <*> (o .:? "simplePnl")+ <*> (o .:? "simplePnlPcnt")+ <*> (o .:? "avgCostPrice")+ <*> (o .:? "avgEntryPrice")+ <*> (o .:? "breakEvenPrice")+ <*> (o .:? "marginCallPrice")+ <*> (o .:? "liquidationPrice")+ <*> (o .:? "bankruptPrice")+ <*> (o .:? "timestamp")+ <*> (o .:? "lastPrice")+ <*> (o .:? "lastValue")++-- | ToJSON Position+instance A.ToJSON Position where+ toJSON Position {..} =+ _omitNulls+ [ "account" .= positionAccount+ , "symbol" .= positionSymbol+ , "currency" .= positionCurrency+ , "underlying" .= positionUnderlying+ , "quoteCurrency" .= positionQuoteCurrency+ , "commission" .= positionCommission+ , "initMarginReq" .= positionInitMarginReq+ , "maintMarginReq" .= positionMaintMarginReq+ , "riskLimit" .= positionRiskLimit+ , "leverage" .= positionLeverage+ , "crossMargin" .= positionCrossMargin+ , "deleveragePercentile" .= positionDeleveragePercentile+ , "rebalancedPnl" .= positionRebalancedPnl+ , "prevRealisedPnl" .= positionPrevRealisedPnl+ , "prevUnrealisedPnl" .= positionPrevUnrealisedPnl+ , "prevClosePrice" .= positionPrevClosePrice+ , "openingTimestamp" .= positionOpeningTimestamp+ , "openingQty" .= positionOpeningQty+ , "openingCost" .= positionOpeningCost+ , "openingComm" .= positionOpeningComm+ , "openOrderBuyQty" .= positionOpenOrderBuyQty+ , "openOrderBuyCost" .= positionOpenOrderBuyCost+ , "openOrderBuyPremium" .= positionOpenOrderBuyPremium+ , "openOrderSellQty" .= positionOpenOrderSellQty+ , "openOrderSellCost" .= positionOpenOrderSellCost+ , "openOrderSellPremium" .= positionOpenOrderSellPremium+ , "execBuyQty" .= positionExecBuyQty+ , "execBuyCost" .= positionExecBuyCost+ , "execSellQty" .= positionExecSellQty+ , "execSellCost" .= positionExecSellCost+ , "execQty" .= positionExecQty+ , "execCost" .= positionExecCost+ , "execComm" .= positionExecComm+ , "currentTimestamp" .= positionCurrentTimestamp+ , "currentQty" .= positionCurrentQty+ , "currentCost" .= positionCurrentCost+ , "currentComm" .= positionCurrentComm+ , "realisedCost" .= positionRealisedCost+ , "unrealisedCost" .= positionUnrealisedCost+ , "grossOpenCost" .= positionGrossOpenCost+ , "grossOpenPremium" .= positionGrossOpenPremium+ , "grossExecCost" .= positionGrossExecCost+ , "isOpen" .= positionIsOpen+ , "markPrice" .= positionMarkPrice+ , "markValue" .= positionMarkValue+ , "riskValue" .= positionRiskValue+ , "homeNotional" .= positionHomeNotional+ , "foreignNotional" .= positionForeignNotional+ , "posState" .= positionPosState+ , "posCost" .= positionPosCost+ , "posCost2" .= positionPosCost2+ , "posCross" .= positionPosCross+ , "posInit" .= positionPosInit+ , "posComm" .= positionPosComm+ , "posLoss" .= positionPosLoss+ , "posMargin" .= positionPosMargin+ , "posMaint" .= positionPosMaint+ , "posAllowance" .= positionPosAllowance+ , "taxableMargin" .= positionTaxableMargin+ , "initMargin" .= positionInitMargin+ , "maintMargin" .= positionMaintMargin+ , "sessionMargin" .= positionSessionMargin+ , "targetExcessMargin" .= positionTargetExcessMargin+ , "varMargin" .= positionVarMargin+ , "realisedGrossPnl" .= positionRealisedGrossPnl+ , "realisedTax" .= positionRealisedTax+ , "realisedPnl" .= positionRealisedPnl+ , "unrealisedGrossPnl" .= positionUnrealisedGrossPnl+ , "longBankrupt" .= positionLongBankrupt+ , "shortBankrupt" .= positionShortBankrupt+ , "taxBase" .= positionTaxBase+ , "indicativeTaxRate" .= positionIndicativeTaxRate+ , "indicativeTax" .= positionIndicativeTax+ , "unrealisedTax" .= positionUnrealisedTax+ , "unrealisedPnl" .= positionUnrealisedPnl+ , "unrealisedPnlPcnt" .= positionUnrealisedPnlPcnt+ , "unrealisedRoePcnt" .= positionUnrealisedRoePcnt+ , "simpleQty" .= positionSimpleQty+ , "simpleCost" .= positionSimpleCost+ , "simpleValue" .= positionSimpleValue+ , "simplePnl" .= positionSimplePnl+ , "simplePnlPcnt" .= positionSimplePnlPcnt+ , "avgCostPrice" .= positionAvgCostPrice+ , "avgEntryPrice" .= positionAvgEntryPrice+ , "breakEvenPrice" .= positionBreakEvenPrice+ , "marginCallPrice" .= positionMarginCallPrice+ , "liquidationPrice" .= positionLiquidationPrice+ , "bankruptPrice" .= positionBankruptPrice+ , "timestamp" .= positionTimestamp+ , "lastPrice" .= positionLastPrice+ , "lastValue" .= positionLastValue+ ]+++-- | Construct a value of type 'Position' (by applying it's required fields, if any)+mkPosition+ :: Double -- ^ 'positionAccount' + -> Text -- ^ 'positionSymbol' + -> Text -- ^ 'positionCurrency' + -> Position+mkPosition positionAccount positionSymbol positionCurrency =+ Position+ { positionAccount+ , positionSymbol+ , positionCurrency+ , positionUnderlying = Nothing+ , positionQuoteCurrency = Nothing+ , positionCommission = Nothing+ , positionInitMarginReq = Nothing+ , positionMaintMarginReq = Nothing+ , positionRiskLimit = Nothing+ , positionLeverage = Nothing+ , positionCrossMargin = Nothing+ , positionDeleveragePercentile = Nothing+ , positionRebalancedPnl = Nothing+ , positionPrevRealisedPnl = Nothing+ , positionPrevUnrealisedPnl = Nothing+ , positionPrevClosePrice = Nothing+ , positionOpeningTimestamp = Nothing+ , positionOpeningQty = Nothing+ , positionOpeningCost = Nothing+ , positionOpeningComm = Nothing+ , positionOpenOrderBuyQty = Nothing+ , positionOpenOrderBuyCost = Nothing+ , positionOpenOrderBuyPremium = Nothing+ , positionOpenOrderSellQty = Nothing+ , positionOpenOrderSellCost = Nothing+ , positionOpenOrderSellPremium = Nothing+ , positionExecBuyQty = Nothing+ , positionExecBuyCost = Nothing+ , positionExecSellQty = Nothing+ , positionExecSellCost = Nothing+ , positionExecQty = Nothing+ , positionExecCost = Nothing+ , positionExecComm = Nothing+ , positionCurrentTimestamp = Nothing+ , positionCurrentQty = Nothing+ , positionCurrentCost = Nothing+ , positionCurrentComm = Nothing+ , positionRealisedCost = Nothing+ , positionUnrealisedCost = Nothing+ , positionGrossOpenCost = Nothing+ , positionGrossOpenPremium = Nothing+ , positionGrossExecCost = Nothing+ , positionIsOpen = Nothing+ , positionMarkPrice = Nothing+ , positionMarkValue = Nothing+ , positionRiskValue = Nothing+ , positionHomeNotional = Nothing+ , positionForeignNotional = Nothing+ , positionPosState = Nothing+ , positionPosCost = Nothing+ , positionPosCost2 = Nothing+ , positionPosCross = Nothing+ , positionPosInit = Nothing+ , positionPosComm = Nothing+ , positionPosLoss = Nothing+ , positionPosMargin = Nothing+ , positionPosMaint = Nothing+ , positionPosAllowance = Nothing+ , positionTaxableMargin = Nothing+ , positionInitMargin = Nothing+ , positionMaintMargin = Nothing+ , positionSessionMargin = Nothing+ , positionTargetExcessMargin = Nothing+ , positionVarMargin = Nothing+ , positionRealisedGrossPnl = Nothing+ , positionRealisedTax = Nothing+ , positionRealisedPnl = Nothing+ , positionUnrealisedGrossPnl = Nothing+ , positionLongBankrupt = Nothing+ , positionShortBankrupt = Nothing+ , positionTaxBase = Nothing+ , positionIndicativeTaxRate = Nothing+ , positionIndicativeTax = Nothing+ , positionUnrealisedTax = Nothing+ , positionUnrealisedPnl = Nothing+ , positionUnrealisedPnlPcnt = Nothing+ , positionUnrealisedRoePcnt = Nothing+ , positionSimpleQty = Nothing+ , positionSimpleCost = Nothing+ , positionSimpleValue = Nothing+ , positionSimplePnl = Nothing+ , positionSimplePnlPcnt = Nothing+ , positionAvgCostPrice = Nothing+ , positionAvgEntryPrice = Nothing+ , positionBreakEvenPrice = Nothing+ , positionMarginCallPrice = Nothing+ , positionLiquidationPrice = Nothing+ , positionBankruptPrice = Nothing+ , positionTimestamp = Nothing+ , positionLastPrice = Nothing+ , positionLastValue = Nothing+ }++-- ** Quote+-- | Quote+-- Best Bid/Offer Snapshots & Historical Bins+data Quote = Quote+ { quoteTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , quoteSymbol :: !(Text) -- ^ /Required/ "symbol"+ , quoteBidSize :: !(Maybe Double) -- ^ "bidSize"+ , quoteBidPrice :: !(Maybe Double) -- ^ "bidPrice"+ , quoteAskPrice :: !(Maybe Double) -- ^ "askPrice"+ , quoteAskSize :: !(Maybe Double) -- ^ "askSize"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Quote+instance A.FromJSON Quote where+ parseJSON = A.withObject "Quote" $ \o ->+ Quote+ <$> (o .: "timestamp")+ <*> (o .: "symbol")+ <*> (o .:? "bidSize")+ <*> (o .:? "bidPrice")+ <*> (o .:? "askPrice")+ <*> (o .:? "askSize")++-- | ToJSON Quote+instance A.ToJSON Quote where+ toJSON Quote {..} =+ _omitNulls+ [ "timestamp" .= quoteTimestamp+ , "symbol" .= quoteSymbol+ , "bidSize" .= quoteBidSize+ , "bidPrice" .= quoteBidPrice+ , "askPrice" .= quoteAskPrice+ , "askSize" .= quoteAskSize+ ]+++-- | Construct a value of type 'Quote' (by applying it's required fields, if any)+mkQuote+ :: DateTime -- ^ 'quoteTimestamp' + -> Text -- ^ 'quoteSymbol' + -> Quote+mkQuote quoteTimestamp quoteSymbol =+ Quote+ { quoteTimestamp+ , quoteSymbol+ , quoteBidSize = Nothing+ , quoteBidPrice = Nothing+ , quoteAskPrice = Nothing+ , quoteAskSize = Nothing+ }++-- ** Settlement+-- | Settlement+-- Historical Settlement Data+data Settlement = Settlement+ { settlementTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , settlementSymbol :: !(Text) -- ^ /Required/ "symbol"+ , settlementSettlementType :: !(Maybe Text) -- ^ "settlementType"+ , settlementSettledPrice :: !(Maybe Double) -- ^ "settledPrice"+ , settlementBankrupt :: !(Maybe Double) -- ^ "bankrupt"+ , settlementTaxBase :: !(Maybe Double) -- ^ "taxBase"+ , settlementTaxRate :: !(Maybe Double) -- ^ "taxRate"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Settlement+instance A.FromJSON Settlement where+ parseJSON = A.withObject "Settlement" $ \o ->+ Settlement+ <$> (o .: "timestamp")+ <*> (o .: "symbol")+ <*> (o .:? "settlementType")+ <*> (o .:? "settledPrice")+ <*> (o .:? "bankrupt")+ <*> (o .:? "taxBase")+ <*> (o .:? "taxRate")++-- | ToJSON Settlement+instance A.ToJSON Settlement where+ toJSON Settlement {..} =+ _omitNulls+ [ "timestamp" .= settlementTimestamp+ , "symbol" .= settlementSymbol+ , "settlementType" .= settlementSettlementType+ , "settledPrice" .= settlementSettledPrice+ , "bankrupt" .= settlementBankrupt+ , "taxBase" .= settlementTaxBase+ , "taxRate" .= settlementTaxRate+ ]+++-- | Construct a value of type 'Settlement' (by applying it's required fields, if any)+mkSettlement+ :: DateTime -- ^ 'settlementTimestamp' + -> Text -- ^ 'settlementSymbol' + -> Settlement+mkSettlement settlementTimestamp settlementSymbol =+ Settlement+ { settlementTimestamp+ , settlementSymbol+ , settlementSettlementType = Nothing+ , settlementSettledPrice = Nothing+ , settlementBankrupt = Nothing+ , settlementTaxBase = Nothing+ , settlementTaxRate = Nothing+ }++-- ** Stats+-- | Stats+-- Exchange Statistics+data Stats = Stats+ { statsRootSymbol :: !(Text) -- ^ /Required/ "rootSymbol"+ , statsCurrency :: !(Maybe Text) -- ^ "currency"+ , statsVolume24h :: !(Maybe Double) -- ^ "volume24h"+ , statsTurnover24h :: !(Maybe Double) -- ^ "turnover24h"+ , statsOpenInterest :: !(Maybe Double) -- ^ "openInterest"+ , statsOpenValue :: !(Maybe Double) -- ^ "openValue"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Stats+instance A.FromJSON Stats where+ parseJSON = A.withObject "Stats" $ \o ->+ Stats+ <$> (o .: "rootSymbol")+ <*> (o .:? "currency")+ <*> (o .:? "volume24h")+ <*> (o .:? "turnover24h")+ <*> (o .:? "openInterest")+ <*> (o .:? "openValue")++-- | ToJSON Stats+instance A.ToJSON Stats where+ toJSON Stats {..} =+ _omitNulls+ [ "rootSymbol" .= statsRootSymbol+ , "currency" .= statsCurrency+ , "volume24h" .= statsVolume24h+ , "turnover24h" .= statsTurnover24h+ , "openInterest" .= statsOpenInterest+ , "openValue" .= statsOpenValue+ ]+++-- | Construct a value of type 'Stats' (by applying it's required fields, if any)+mkStats+ :: Text -- ^ 'statsRootSymbol' + -> Stats+mkStats statsRootSymbol =+ Stats+ { statsRootSymbol+ , statsCurrency = Nothing+ , statsVolume24h = Nothing+ , statsTurnover24h = Nothing+ , statsOpenInterest = Nothing+ , statsOpenValue = Nothing+ }++-- ** StatsHistory+-- | StatsHistory+data StatsHistory = StatsHistory+ { statsHistoryDate :: !(DateTime) -- ^ /Required/ "date"+ , statsHistoryRootSymbol :: !(Text) -- ^ /Required/ "rootSymbol"+ , statsHistoryCurrency :: !(Maybe Text) -- ^ "currency"+ , statsHistoryVolume :: !(Maybe Double) -- ^ "volume"+ , statsHistoryTurnover :: !(Maybe Double) -- ^ "turnover"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON StatsHistory+instance A.FromJSON StatsHistory where+ parseJSON = A.withObject "StatsHistory" $ \o ->+ StatsHistory+ <$> (o .: "date")+ <*> (o .: "rootSymbol")+ <*> (o .:? "currency")+ <*> (o .:? "volume")+ <*> (o .:? "turnover")++-- | ToJSON StatsHistory+instance A.ToJSON StatsHistory where+ toJSON StatsHistory {..} =+ _omitNulls+ [ "date" .= statsHistoryDate+ , "rootSymbol" .= statsHistoryRootSymbol+ , "currency" .= statsHistoryCurrency+ , "volume" .= statsHistoryVolume+ , "turnover" .= statsHistoryTurnover+ ]+++-- | Construct a value of type 'StatsHistory' (by applying it's required fields, if any)+mkStatsHistory+ :: DateTime -- ^ 'statsHistoryDate' + -> Text -- ^ 'statsHistoryRootSymbol' + -> StatsHistory+mkStatsHistory statsHistoryDate statsHistoryRootSymbol =+ StatsHistory+ { statsHistoryDate+ , statsHistoryRootSymbol+ , statsHistoryCurrency = Nothing+ , statsHistoryVolume = Nothing+ , statsHistoryTurnover = Nothing+ }++-- ** StatsUSD+-- | StatsUSD+data StatsUSD = StatsUSD+ { statsUSDRootSymbol :: !(Text) -- ^ /Required/ "rootSymbol"+ , statsUSDCurrency :: !(Maybe Text) -- ^ "currency"+ , statsUSDTurnover24h :: !(Maybe Double) -- ^ "turnover24h"+ , statsUSDTurnover30d :: !(Maybe Double) -- ^ "turnover30d"+ , statsUSDTurnover365d :: !(Maybe Double) -- ^ "turnover365d"+ , statsUSDTurnover :: !(Maybe Double) -- ^ "turnover"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON StatsUSD+instance A.FromJSON StatsUSD where+ parseJSON = A.withObject "StatsUSD" $ \o ->+ StatsUSD+ <$> (o .: "rootSymbol")+ <*> (o .:? "currency")+ <*> (o .:? "turnover24h")+ <*> (o .:? "turnover30d")+ <*> (o .:? "turnover365d")+ <*> (o .:? "turnover")++-- | ToJSON StatsUSD+instance A.ToJSON StatsUSD where+ toJSON StatsUSD {..} =+ _omitNulls+ [ "rootSymbol" .= statsUSDRootSymbol+ , "currency" .= statsUSDCurrency+ , "turnover24h" .= statsUSDTurnover24h+ , "turnover30d" .= statsUSDTurnover30d+ , "turnover365d" .= statsUSDTurnover365d+ , "turnover" .= statsUSDTurnover+ ]+++-- | Construct a value of type 'StatsUSD' (by applying it's required fields, if any)+mkStatsUSD+ :: Text -- ^ 'statsUSDRootSymbol' + -> StatsUSD+mkStatsUSD statsUSDRootSymbol =+ StatsUSD+ { statsUSDRootSymbol+ , statsUSDCurrency = Nothing+ , statsUSDTurnover24h = Nothing+ , statsUSDTurnover30d = Nothing+ , statsUSDTurnover365d = Nothing+ , statsUSDTurnover = Nothing+ }++-- ** Trade+-- | Trade+-- Individual & Bucketed Trades+data Trade = Trade+ { tradeTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , tradeSymbol :: !(Text) -- ^ /Required/ "symbol"+ , tradeSide :: !(Maybe Text) -- ^ "side"+ , tradeSize :: !(Maybe Double) -- ^ "size"+ , tradePrice :: !(Maybe Double) -- ^ "price"+ , tradeTickDirection :: !(Maybe Text) -- ^ "tickDirection"+ , tradeTrdMatchId :: !(Maybe Text) -- ^ "trdMatchID"+ , tradeGrossValue :: !(Maybe Double) -- ^ "grossValue"+ , tradeHomeNotional :: !(Maybe Double) -- ^ "homeNotional"+ , tradeForeignNotional :: !(Maybe Double) -- ^ "foreignNotional"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Trade+instance A.FromJSON Trade where+ parseJSON = A.withObject "Trade" $ \o ->+ Trade+ <$> (o .: "timestamp")+ <*> (o .: "symbol")+ <*> (o .:? "side")+ <*> (o .:? "size")+ <*> (o .:? "price")+ <*> (o .:? "tickDirection")+ <*> (o .:? "trdMatchID")+ <*> (o .:? "grossValue")+ <*> (o .:? "homeNotional")+ <*> (o .:? "foreignNotional")++-- | ToJSON Trade+instance A.ToJSON Trade where+ toJSON Trade {..} =+ _omitNulls+ [ "timestamp" .= tradeTimestamp+ , "symbol" .= tradeSymbol+ , "side" .= tradeSide+ , "size" .= tradeSize+ , "price" .= tradePrice+ , "tickDirection" .= tradeTickDirection+ , "trdMatchID" .= tradeTrdMatchId+ , "grossValue" .= tradeGrossValue+ , "homeNotional" .= tradeHomeNotional+ , "foreignNotional" .= tradeForeignNotional+ ]+++-- | Construct a value of type 'Trade' (by applying it's required fields, if any)+mkTrade+ :: DateTime -- ^ 'tradeTimestamp' + -> Text -- ^ 'tradeSymbol' + -> Trade+mkTrade tradeTimestamp tradeSymbol =+ Trade+ { tradeTimestamp+ , tradeSymbol+ , tradeSide = Nothing+ , tradeSize = Nothing+ , tradePrice = Nothing+ , tradeTickDirection = Nothing+ , tradeTrdMatchId = Nothing+ , tradeGrossValue = Nothing+ , tradeHomeNotional = Nothing+ , tradeForeignNotional = Nothing+ }++-- ** TradeBin+-- | TradeBin+data TradeBin = TradeBin+ { tradeBinTimestamp :: !(DateTime) -- ^ /Required/ "timestamp"+ , tradeBinSymbol :: !(Text) -- ^ /Required/ "symbol"+ , tradeBinOpen :: !(Maybe Double) -- ^ "open"+ , tradeBinHigh :: !(Maybe Double) -- ^ "high"+ , tradeBinLow :: !(Maybe Double) -- ^ "low"+ , tradeBinClose :: !(Maybe Double) -- ^ "close"+ , tradeBinTrades :: !(Maybe Double) -- ^ "trades"+ , tradeBinVolume :: !(Maybe Double) -- ^ "volume"+ , tradeBinVwap :: !(Maybe Double) -- ^ "vwap"+ , tradeBinLastSize :: !(Maybe Double) -- ^ "lastSize"+ , tradeBinTurnover :: !(Maybe Double) -- ^ "turnover"+ , tradeBinHomeNotional :: !(Maybe Double) -- ^ "homeNotional"+ , tradeBinForeignNotional :: !(Maybe Double) -- ^ "foreignNotional"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON TradeBin+instance A.FromJSON TradeBin where+ parseJSON = A.withObject "TradeBin" $ \o ->+ TradeBin+ <$> (o .: "timestamp")+ <*> (o .: "symbol")+ <*> (o .:? "open")+ <*> (o .:? "high")+ <*> (o .:? "low")+ <*> (o .:? "close")+ <*> (o .:? "trades")+ <*> (o .:? "volume")+ <*> (o .:? "vwap")+ <*> (o .:? "lastSize")+ <*> (o .:? "turnover")+ <*> (o .:? "homeNotional")+ <*> (o .:? "foreignNotional")++-- | ToJSON TradeBin+instance A.ToJSON TradeBin where+ toJSON TradeBin {..} =+ _omitNulls+ [ "timestamp" .= tradeBinTimestamp+ , "symbol" .= tradeBinSymbol+ , "open" .= tradeBinOpen+ , "high" .= tradeBinHigh+ , "low" .= tradeBinLow+ , "close" .= tradeBinClose+ , "trades" .= tradeBinTrades+ , "volume" .= tradeBinVolume+ , "vwap" .= tradeBinVwap+ , "lastSize" .= tradeBinLastSize+ , "turnover" .= tradeBinTurnover+ , "homeNotional" .= tradeBinHomeNotional+ , "foreignNotional" .= tradeBinForeignNotional+ ]+++-- | Construct a value of type 'TradeBin' (by applying it's required fields, if any)+mkTradeBin+ :: DateTime -- ^ 'tradeBinTimestamp' + -> Text -- ^ 'tradeBinSymbol' + -> TradeBin+mkTradeBin tradeBinTimestamp tradeBinSymbol =+ TradeBin+ { tradeBinTimestamp+ , tradeBinSymbol+ , tradeBinOpen = Nothing+ , tradeBinHigh = Nothing+ , tradeBinLow = Nothing+ , tradeBinClose = Nothing+ , tradeBinTrades = Nothing+ , tradeBinVolume = Nothing+ , tradeBinVwap = Nothing+ , tradeBinLastSize = Nothing+ , tradeBinTurnover = Nothing+ , tradeBinHomeNotional = Nothing+ , tradeBinForeignNotional = Nothing+ }++-- ** Transaction+-- | Transaction+data Transaction = Transaction+ { transactionTransactId :: !(Text) -- ^ /Required/ "transactID"+ , transactionAccount :: !(Maybe Double) -- ^ "account"+ , transactionCurrency :: !(Maybe Text) -- ^ "currency"+ , transactionTransactType :: !(Maybe Text) -- ^ "transactType"+ , transactionAmount :: !(Maybe Double) -- ^ "amount"+ , transactionFee :: !(Maybe Double) -- ^ "fee"+ , transactionTransactStatus :: !(Maybe Text) -- ^ "transactStatus"+ , transactionAddress :: !(Maybe Text) -- ^ "address"+ , transactionTx :: !(Maybe Text) -- ^ "tx"+ , transactionText :: !(Maybe Text) -- ^ "text"+ , transactionTransactTime :: !(Maybe DateTime) -- ^ "transactTime"+ , transactionTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Transaction+instance A.FromJSON Transaction where+ parseJSON = A.withObject "Transaction" $ \o ->+ Transaction+ <$> (o .: "transactID")+ <*> (o .:? "account")+ <*> (o .:? "currency")+ <*> (o .:? "transactType")+ <*> (o .:? "amount")+ <*> (o .:? "fee")+ <*> (o .:? "transactStatus")+ <*> (o .:? "address")+ <*> (o .:? "tx")+ <*> (o .:? "text")+ <*> (o .:? "transactTime")+ <*> (o .:? "timestamp")++-- | ToJSON Transaction+instance A.ToJSON Transaction where+ toJSON Transaction {..} =+ _omitNulls+ [ "transactID" .= transactionTransactId+ , "account" .= transactionAccount+ , "currency" .= transactionCurrency+ , "transactType" .= transactionTransactType+ , "amount" .= transactionAmount+ , "fee" .= transactionFee+ , "transactStatus" .= transactionTransactStatus+ , "address" .= transactionAddress+ , "tx" .= transactionTx+ , "text" .= transactionText+ , "transactTime" .= transactionTransactTime+ , "timestamp" .= transactionTimestamp+ ]+++-- | Construct a value of type 'Transaction' (by applying it's required fields, if any)+mkTransaction+ :: Text -- ^ 'transactionTransactId' + -> Transaction+mkTransaction transactionTransactId =+ Transaction+ { transactionTransactId+ , transactionAccount = Nothing+ , transactionCurrency = Nothing+ , transactionTransactType = Nothing+ , transactionAmount = Nothing+ , transactionFee = Nothing+ , transactionTransactStatus = Nothing+ , transactionAddress = Nothing+ , transactionTx = Nothing+ , transactionText = Nothing+ , transactionTransactTime = Nothing+ , transactionTimestamp = Nothing+ }++-- ** User+-- | User+-- Account Operations+data User = User+ { userId :: !(Maybe Double) -- ^ "id"+ , userOwnerId :: !(Maybe Double) -- ^ "ownerId"+ , userFirstname :: !(Maybe Text) -- ^ "firstname"+ , userLastname :: !(Maybe Text) -- ^ "lastname"+ , userUsername :: !(Text) -- ^ /Required/ "username"+ , userEmail :: !(Text) -- ^ /Required/ "email"+ , userPhone :: !(Maybe Text) -- ^ "phone"+ , userCreated :: !(Maybe DateTime) -- ^ "created"+ , userLastUpdated :: !(Maybe DateTime) -- ^ "lastUpdated"+ , userPreferences :: !(Maybe UserPreferences) -- ^ "preferences"+ , userTfaEnabled :: !(Maybe Text) -- ^ "TFAEnabled"+ , userAffiliateId :: !(Maybe Text) -- ^ "affiliateID"+ , userPgpPubKey :: !(Maybe Text) -- ^ "pgpPubKey"+ , userCountry :: !(Maybe Text) -- ^ "country"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON User+instance A.FromJSON User where+ parseJSON = A.withObject "User" $ \o ->+ User+ <$> (o .:? "id")+ <*> (o .:? "ownerId")+ <*> (o .:? "firstname")+ <*> (o .:? "lastname")+ <*> (o .: "username")+ <*> (o .: "email")+ <*> (o .:? "phone")+ <*> (o .:? "created")+ <*> (o .:? "lastUpdated")+ <*> (o .:? "preferences")+ <*> (o .:? "TFAEnabled")+ <*> (o .:? "affiliateID")+ <*> (o .:? "pgpPubKey")+ <*> (o .:? "country")++-- | ToJSON User+instance A.ToJSON User where+ toJSON User {..} =+ _omitNulls+ [ "id" .= userId+ , "ownerId" .= userOwnerId+ , "firstname" .= userFirstname+ , "lastname" .= userLastname+ , "username" .= userUsername+ , "email" .= userEmail+ , "phone" .= userPhone+ , "created" .= userCreated+ , "lastUpdated" .= userLastUpdated+ , "preferences" .= userPreferences+ , "TFAEnabled" .= userTfaEnabled+ , "affiliateID" .= userAffiliateId+ , "pgpPubKey" .= userPgpPubKey+ , "country" .= userCountry+ ]+++-- | Construct a value of type 'User' (by applying it's required fields, if any)+mkUser+ :: Text -- ^ 'userUsername' + -> Text -- ^ 'userEmail' + -> User+mkUser userUsername userEmail =+ User+ { userId = Nothing+ , userOwnerId = Nothing+ , userFirstname = Nothing+ , userLastname = Nothing+ , userUsername+ , userEmail+ , userPhone = Nothing+ , userCreated = Nothing+ , userLastUpdated = Nothing+ , userPreferences = Nothing+ , userTfaEnabled = Nothing+ , userAffiliateId = Nothing+ , userPgpPubKey = Nothing+ , userCountry = Nothing+ }++-- ** UserCommission+-- | UserCommission+data UserCommission = UserCommission+ { userCommissionMakerFee :: !(Maybe Double) -- ^ "makerFee"+ , userCommissionTakerFee :: !(Maybe Double) -- ^ "takerFee"+ , userCommissionSettlementFee :: !(Maybe Double) -- ^ "settlementFee"+ , userCommissionMaxFee :: !(Maybe Double) -- ^ "maxFee"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON UserCommission+instance A.FromJSON UserCommission where+ parseJSON = A.withObject "UserCommission" $ \o ->+ UserCommission+ <$> (o .:? "makerFee")+ <*> (o .:? "takerFee")+ <*> (o .:? "settlementFee")+ <*> (o .:? "maxFee")++-- | ToJSON UserCommission+instance A.ToJSON UserCommission where+ toJSON UserCommission {..} =+ _omitNulls+ [ "makerFee" .= userCommissionMakerFee+ , "takerFee" .= userCommissionTakerFee+ , "settlementFee" .= userCommissionSettlementFee+ , "maxFee" .= userCommissionMaxFee+ ]+++-- | Construct a value of type 'UserCommission' (by applying it's required fields, if any)+mkUserCommission+ :: UserCommission+mkUserCommission =+ UserCommission+ { userCommissionMakerFee = Nothing+ , userCommissionTakerFee = Nothing+ , userCommissionSettlementFee = Nothing+ , userCommissionMaxFee = Nothing+ }++-- ** UserPreferences+-- | UserPreferences+data UserPreferences = UserPreferences+ { userPreferencesAlertOnLiquidations :: !(Maybe Bool) -- ^ "alertOnLiquidations"+ , userPreferencesAnimationsEnabled :: !(Maybe Bool) -- ^ "animationsEnabled"+ , userPreferencesAnnouncementsLastSeen :: !(Maybe DateTime) -- ^ "announcementsLastSeen"+ , userPreferencesChatChannelId :: !(Maybe Double) -- ^ "chatChannelID"+ , userPreferencesColorTheme :: !(Maybe Text) -- ^ "colorTheme"+ , userPreferencesCurrency :: !(Maybe Text) -- ^ "currency"+ , userPreferencesDebug :: !(Maybe Bool) -- ^ "debug"+ , userPreferencesDisableEmails :: !(Maybe [Text]) -- ^ "disableEmails"+ , userPreferencesHideConfirmDialogs :: !(Maybe [Text]) -- ^ "hideConfirmDialogs"+ , userPreferencesHideConnectionModal :: !(Maybe Bool) -- ^ "hideConnectionModal"+ , userPreferencesHideFromLeaderboard :: !(Maybe Bool) -- ^ "hideFromLeaderboard"+ , userPreferencesHideNameFromLeaderboard :: !(Maybe Bool) -- ^ "hideNameFromLeaderboard"+ , userPreferencesHideNotifications :: !(Maybe [Text]) -- ^ "hideNotifications"+ , userPreferencesLocale :: !(Maybe Text) -- ^ "locale"+ , userPreferencesMsgsSeen :: !(Maybe [Text]) -- ^ "msgsSeen"+ , userPreferencesOrderBookBinning :: !(Maybe A.Value) -- ^ "orderBookBinning"+ , userPreferencesOrderBookType :: !(Maybe Text) -- ^ "orderBookType"+ , userPreferencesOrderClearImmediate :: !(Maybe Bool) -- ^ "orderClearImmediate"+ , userPreferencesOrderControlsPlusMinus :: !(Maybe Bool) -- ^ "orderControlsPlusMinus"+ , userPreferencesSounds :: !(Maybe [Text]) -- ^ "sounds"+ , userPreferencesStrictIpCheck :: !(Maybe Bool) -- ^ "strictIPCheck"+ , userPreferencesStrictTimeout :: !(Maybe Bool) -- ^ "strictTimeout"+ , userPreferencesTickerGroup :: !(Maybe Text) -- ^ "tickerGroup"+ , userPreferencesTickerPinned :: !(Maybe Bool) -- ^ "tickerPinned"+ , userPreferencesTradeLayout :: !(Maybe Text) -- ^ "tradeLayout"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON UserPreferences+instance A.FromJSON UserPreferences where+ parseJSON = A.withObject "UserPreferences" $ \o ->+ UserPreferences+ <$> (o .:? "alertOnLiquidations")+ <*> (o .:? "animationsEnabled")+ <*> (o .:? "announcementsLastSeen")+ <*> (o .:? "chatChannelID")+ <*> (o .:? "colorTheme")+ <*> (o .:? "currency")+ <*> (o .:? "debug")+ <*> (o .:? "disableEmails")+ <*> (o .:? "hideConfirmDialogs")+ <*> (o .:? "hideConnectionModal")+ <*> (o .:? "hideFromLeaderboard")+ <*> (o .:? "hideNameFromLeaderboard")+ <*> (o .:? "hideNotifications")+ <*> (o .:? "locale")+ <*> (o .:? "msgsSeen")+ <*> (o .:? "orderBookBinning")+ <*> (o .:? "orderBookType")+ <*> (o .:? "orderClearImmediate")+ <*> (o .:? "orderControlsPlusMinus")+ <*> (o .:? "sounds")+ <*> (o .:? "strictIPCheck")+ <*> (o .:? "strictTimeout")+ <*> (o .:? "tickerGroup")+ <*> (o .:? "tickerPinned")+ <*> (o .:? "tradeLayout")++-- | ToJSON UserPreferences+instance A.ToJSON UserPreferences where+ toJSON UserPreferences {..} =+ _omitNulls+ [ "alertOnLiquidations" .= userPreferencesAlertOnLiquidations+ , "animationsEnabled" .= userPreferencesAnimationsEnabled+ , "announcementsLastSeen" .= userPreferencesAnnouncementsLastSeen+ , "chatChannelID" .= userPreferencesChatChannelId+ , "colorTheme" .= userPreferencesColorTheme+ , "currency" .= userPreferencesCurrency+ , "debug" .= userPreferencesDebug+ , "disableEmails" .= userPreferencesDisableEmails+ , "hideConfirmDialogs" .= userPreferencesHideConfirmDialogs+ , "hideConnectionModal" .= userPreferencesHideConnectionModal+ , "hideFromLeaderboard" .= userPreferencesHideFromLeaderboard+ , "hideNameFromLeaderboard" .= userPreferencesHideNameFromLeaderboard+ , "hideNotifications" .= userPreferencesHideNotifications+ , "locale" .= userPreferencesLocale+ , "msgsSeen" .= userPreferencesMsgsSeen+ , "orderBookBinning" .= userPreferencesOrderBookBinning+ , "orderBookType" .= userPreferencesOrderBookType+ , "orderClearImmediate" .= userPreferencesOrderClearImmediate+ , "orderControlsPlusMinus" .= userPreferencesOrderControlsPlusMinus+ , "sounds" .= userPreferencesSounds+ , "strictIPCheck" .= userPreferencesStrictIpCheck+ , "strictTimeout" .= userPreferencesStrictTimeout+ , "tickerGroup" .= userPreferencesTickerGroup+ , "tickerPinned" .= userPreferencesTickerPinned+ , "tradeLayout" .= userPreferencesTradeLayout+ ]+++-- | Construct a value of type 'UserPreferences' (by applying it's required fields, if any)+mkUserPreferences+ :: UserPreferences+mkUserPreferences =+ UserPreferences+ { userPreferencesAlertOnLiquidations = Nothing+ , userPreferencesAnimationsEnabled = Nothing+ , userPreferencesAnnouncementsLastSeen = Nothing+ , userPreferencesChatChannelId = Nothing+ , userPreferencesColorTheme = Nothing+ , userPreferencesCurrency = Nothing+ , userPreferencesDebug = Nothing+ , userPreferencesDisableEmails = Nothing+ , userPreferencesHideConfirmDialogs = Nothing+ , userPreferencesHideConnectionModal = Nothing+ , userPreferencesHideFromLeaderboard = Nothing+ , userPreferencesHideNameFromLeaderboard = Nothing+ , userPreferencesHideNotifications = Nothing+ , userPreferencesLocale = Nothing+ , userPreferencesMsgsSeen = Nothing+ , userPreferencesOrderBookBinning = Nothing+ , userPreferencesOrderBookType = Nothing+ , userPreferencesOrderClearImmediate = Nothing+ , userPreferencesOrderControlsPlusMinus = Nothing+ , userPreferencesSounds = Nothing+ , userPreferencesStrictIpCheck = Nothing+ , userPreferencesStrictTimeout = Nothing+ , userPreferencesTickerGroup = Nothing+ , userPreferencesTickerPinned = Nothing+ , userPreferencesTradeLayout = Nothing+ }++-- ** Wallet+-- | Wallet+data Wallet = Wallet+ { walletAccount :: !(Double) -- ^ /Required/ "account"+ , walletCurrency :: !(Text) -- ^ /Required/ "currency"+ , walletPrevDeposited :: !(Maybe Double) -- ^ "prevDeposited"+ , walletPrevWithdrawn :: !(Maybe Double) -- ^ "prevWithdrawn"+ , walletPrevTransferIn :: !(Maybe Double) -- ^ "prevTransferIn"+ , walletPrevTransferOut :: !(Maybe Double) -- ^ "prevTransferOut"+ , walletPrevAmount :: !(Maybe Double) -- ^ "prevAmount"+ , walletPrevTimestamp :: !(Maybe DateTime) -- ^ "prevTimestamp"+ , walletDeltaDeposited :: !(Maybe Double) -- ^ "deltaDeposited"+ , walletDeltaWithdrawn :: !(Maybe Double) -- ^ "deltaWithdrawn"+ , walletDeltaTransferIn :: !(Maybe Double) -- ^ "deltaTransferIn"+ , walletDeltaTransferOut :: !(Maybe Double) -- ^ "deltaTransferOut"+ , walletDeltaAmount :: !(Maybe Double) -- ^ "deltaAmount"+ , walletDeposited :: !(Maybe Double) -- ^ "deposited"+ , walletWithdrawn :: !(Maybe Double) -- ^ "withdrawn"+ , walletTransferIn :: !(Maybe Double) -- ^ "transferIn"+ , walletTransferOut :: !(Maybe Double) -- ^ "transferOut"+ , walletAmount :: !(Maybe Double) -- ^ "amount"+ , walletPendingCredit :: !(Maybe Double) -- ^ "pendingCredit"+ , walletPendingDebit :: !(Maybe Double) -- ^ "pendingDebit"+ , walletConfirmedDebit :: !(Maybe Double) -- ^ "confirmedDebit"+ , walletTimestamp :: !(Maybe DateTime) -- ^ "timestamp"+ , walletAddr :: !(Maybe Text) -- ^ "addr"+ , walletScript :: !(Maybe Text) -- ^ "script"+ , walletWithdrawalLock :: !(Maybe [Text]) -- ^ "withdrawalLock"+ } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON Wallet+instance A.FromJSON Wallet where+ parseJSON = A.withObject "Wallet" $ \o ->+ Wallet+ <$> (o .: "account")+ <*> (o .: "currency")+ <*> (o .:? "prevDeposited")+ <*> (o .:? "prevWithdrawn")+ <*> (o .:? "prevTransferIn")+ <*> (o .:? "prevTransferOut")+ <*> (o .:? "prevAmount")+ <*> (o .:? "prevTimestamp")+ <*> (o .:? "deltaDeposited")+ <*> (o .:? "deltaWithdrawn")+ <*> (o .:? "deltaTransferIn")+ <*> (o .:? "deltaTransferOut")+ <*> (o .:? "deltaAmount")+ <*> (o .:? "deposited")+ <*> (o .:? "withdrawn")+ <*> (o .:? "transferIn")+ <*> (o .:? "transferOut")+ <*> (o .:? "amount")+ <*> (o .:? "pendingCredit")+ <*> (o .:? "pendingDebit")+ <*> (o .:? "confirmedDebit")+ <*> (o .:? "timestamp")+ <*> (o .:? "addr")+ <*> (o .:? "script")+ <*> (o .:? "withdrawalLock")++-- | ToJSON Wallet+instance A.ToJSON Wallet where+ toJSON Wallet {..} =+ _omitNulls+ [ "account" .= walletAccount+ , "currency" .= walletCurrency+ , "prevDeposited" .= walletPrevDeposited+ , "prevWithdrawn" .= walletPrevWithdrawn+ , "prevTransferIn" .= walletPrevTransferIn+ , "prevTransferOut" .= walletPrevTransferOut+ , "prevAmount" .= walletPrevAmount+ , "prevTimestamp" .= walletPrevTimestamp+ , "deltaDeposited" .= walletDeltaDeposited+ , "deltaWithdrawn" .= walletDeltaWithdrawn+ , "deltaTransferIn" .= walletDeltaTransferIn+ , "deltaTransferOut" .= walletDeltaTransferOut+ , "deltaAmount" .= walletDeltaAmount+ , "deposited" .= walletDeposited+ , "withdrawn" .= walletWithdrawn+ , "transferIn" .= walletTransferIn+ , "transferOut" .= walletTransferOut+ , "amount" .= walletAmount+ , "pendingCredit" .= walletPendingCredit+ , "pendingDebit" .= walletPendingDebit+ , "confirmedDebit" .= walletConfirmedDebit+ , "timestamp" .= walletTimestamp+ , "addr" .= walletAddr+ , "script" .= walletScript+ , "withdrawalLock" .= walletWithdrawalLock+ ]+++-- | Construct a value of type 'Wallet' (by applying it's required fields, if any)+mkWallet+ :: Double -- ^ 'walletAccount' + -> Text -- ^ 'walletCurrency' + -> Wallet+mkWallet walletAccount walletCurrency =+ Wallet+ { walletAccount+ , walletCurrency+ , walletPrevDeposited = Nothing+ , walletPrevWithdrawn = Nothing+ , walletPrevTransferIn = Nothing+ , walletPrevTransferOut = Nothing+ , walletPrevAmount = Nothing+ , walletPrevTimestamp = Nothing+ , walletDeltaDeposited = Nothing+ , walletDeltaWithdrawn = Nothing+ , walletDeltaTransferIn = Nothing+ , walletDeltaTransferOut = Nothing+ , walletDeltaAmount = Nothing+ , walletDeposited = Nothing+ , walletWithdrawn = Nothing+ , walletTransferIn = Nothing+ , walletTransferOut = Nothing+ , walletAmount = Nothing+ , walletPendingCredit = Nothing+ , walletPendingDebit = Nothing+ , walletConfirmedDebit = Nothing+ , walletTimestamp = Nothing+ , walletAddr = Nothing+ , walletScript = Nothing+ , walletWithdrawalLock = Nothing+ }++-- ** XAny+-- | XAny+data XAny = XAny+ { + } deriving (P.Show, P.Eq, P.Typeable)++-- | FromJSON XAny+instance A.FromJSON XAny where+ parseJSON = A.withObject "XAny" $ \o ->+ pure XAny+ ++-- | ToJSON XAny+instance A.ToJSON XAny where+ toJSON XAny =+ _omitNulls+ [ + ]+++-- | Construct a value of type 'XAny' (by applying it's required fields, if any)+mkXAny+ :: XAny+mkXAny =+ XAny+ { + }+++-- * Enums+++-- ** E'Type++-- | Enum of 'Text'+data E'Type+ = E'Type'Success -- ^ @"success"@+ | E'Type'Error -- ^ @"error"@+ | E'Type'Info -- ^ @"info"@+ deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)++instance A.ToJSON E'Type where toJSON = A.toJSON . fromE'Type+instance A.FromJSON E'Type where parseJSON o = P.either P.fail (pure . P.id) . toE'Type =<< A.parseJSON o+instance WH.ToHttpApiData E'Type where toQueryParam = WH.toQueryParam . fromE'Type+instance WH.FromHttpApiData E'Type where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'Type+instance MimeRender MimeMultipartFormData E'Type where mimeRender _ = mimeRenderDefaultMultipartFormData++-- | unwrap 'E'Type' enum+fromE'Type :: E'Type -> Text+fromE'Type = \case+ E'Type'Success -> "success"+ E'Type'Error -> "error"+ E'Type'Info -> "info"++-- | parse 'E'Type' enum+toE'Type :: Text -> P.Either String E'Type+toE'Type = \case+ "success" -> P.Right E'Type'Success+ "error" -> P.Right E'Type'Error+ "info" -> P.Right E'Type'Info+ s -> P.Left $ "toE'Type: enum parse failure: " P.++ P.show s
+ lib/BitMEX/ModelLens.hs view
@@ -0,0 +1,2871 @@+{-+ BitMEX API++ ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. ++ OpenAPI spec version: 2.0+ BitMEX API API version: 1.2.0+ Contact: support@bitmex.com+ Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)+-}++{-|+Module : BitMEX.Lens+-}++{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE RecordWildCards #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-matches -fno-warn-unused-binds -fno-warn-unused-imports #-}++module BitMEX.ModelLens where++import qualified Data.Aeson as A+import qualified Data.ByteString.Lazy as BL+import qualified Data.Data as P (Data, Typeable)+import qualified Data.Map as Map+import qualified Data.Set as Set+import qualified Data.Time as TI++import Data.Text (Text)++import Prelude (($), (.),(<$>),(<*>),(=<<),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)+import qualified Prelude as P++import BitMEX.Model+import BitMEX.Core+++-- * APIKey++-- | 'aPIKeyId' Lens+aPIKeyIdL :: Lens_' APIKey (Text)+aPIKeyIdL f APIKey{..} = (\aPIKeyId -> APIKey { aPIKeyId, ..} ) <$> f aPIKeyId+{-# INLINE aPIKeyIdL #-}++-- | 'aPIKeySecret' Lens+aPIKeySecretL :: Lens_' APIKey (Text)+aPIKeySecretL f APIKey{..} = (\aPIKeySecret -> APIKey { aPIKeySecret, ..} ) <$> f aPIKeySecret+{-# INLINE aPIKeySecretL #-}++-- | 'aPIKeyName' Lens+aPIKeyNameL :: Lens_' APIKey (Text)+aPIKeyNameL f APIKey{..} = (\aPIKeyName -> APIKey { aPIKeyName, ..} ) <$> f aPIKeyName+{-# INLINE aPIKeyNameL #-}++-- | 'aPIKeyNonce' Lens+aPIKeyNonceL :: Lens_' APIKey (Double)+aPIKeyNonceL f APIKey{..} = (\aPIKeyNonce -> APIKey { aPIKeyNonce, ..} ) <$> f aPIKeyNonce+{-# INLINE aPIKeyNonceL #-}++-- | 'aPIKeyCidr' Lens+aPIKeyCidrL :: Lens_' APIKey (Maybe Text)+aPIKeyCidrL f APIKey{..} = (\aPIKeyCidr -> APIKey { aPIKeyCidr, ..} ) <$> f aPIKeyCidr+{-# INLINE aPIKeyCidrL #-}++-- | 'aPIKeyPermissions' Lens+aPIKeyPermissionsL :: Lens_' APIKey (Maybe [XAny])+aPIKeyPermissionsL f APIKey{..} = (\aPIKeyPermissions -> APIKey { aPIKeyPermissions, ..} ) <$> f aPIKeyPermissions+{-# INLINE aPIKeyPermissionsL #-}++-- | 'aPIKeyEnabled' Lens+aPIKeyEnabledL :: Lens_' APIKey (Maybe Bool)+aPIKeyEnabledL f APIKey{..} = (\aPIKeyEnabled -> APIKey { aPIKeyEnabled, ..} ) <$> f aPIKeyEnabled+{-# INLINE aPIKeyEnabledL #-}++-- | 'aPIKeyUserId' Lens+aPIKeyUserIdL :: Lens_' APIKey (Double)+aPIKeyUserIdL f APIKey{..} = (\aPIKeyUserId -> APIKey { aPIKeyUserId, ..} ) <$> f aPIKeyUserId+{-# INLINE aPIKeyUserIdL #-}++-- | 'aPIKeyCreated' Lens+aPIKeyCreatedL :: Lens_' APIKey (Maybe DateTime)+aPIKeyCreatedL f APIKey{..} = (\aPIKeyCreated -> APIKey { aPIKeyCreated, ..} ) <$> f aPIKeyCreated+{-# INLINE aPIKeyCreatedL #-}++++-- * AccessToken++-- | 'accessTokenId' Lens+accessTokenIdL :: Lens_' AccessToken (Text)+accessTokenIdL f AccessToken{..} = (\accessTokenId -> AccessToken { accessTokenId, ..} ) <$> f accessTokenId+{-# INLINE accessTokenIdL #-}++-- | 'accessTokenTtl' Lens+accessTokenTtlL :: Lens_' AccessToken (Maybe Double)+accessTokenTtlL f AccessToken{..} = (\accessTokenTtl -> AccessToken { accessTokenTtl, ..} ) <$> f accessTokenTtl+{-# INLINE accessTokenTtlL #-}++-- | 'accessTokenCreated' Lens+accessTokenCreatedL :: Lens_' AccessToken (Maybe DateTime)+accessTokenCreatedL f AccessToken{..} = (\accessTokenCreated -> AccessToken { accessTokenCreated, ..} ) <$> f accessTokenCreated+{-# INLINE accessTokenCreatedL #-}++-- | 'accessTokenUserId' Lens+accessTokenUserIdL :: Lens_' AccessToken (Maybe Double)+accessTokenUserIdL f AccessToken{..} = (\accessTokenUserId -> AccessToken { accessTokenUserId, ..} ) <$> f accessTokenUserId+{-# INLINE accessTokenUserIdL #-}++++-- * Affiliate++-- | 'affiliateAccount' Lens+affiliateAccountL :: Lens_' Affiliate (Double)+affiliateAccountL f Affiliate{..} = (\affiliateAccount -> Affiliate { affiliateAccount, ..} ) <$> f affiliateAccount+{-# INLINE affiliateAccountL #-}++-- | 'affiliateCurrency' Lens+affiliateCurrencyL :: Lens_' Affiliate (Text)+affiliateCurrencyL f Affiliate{..} = (\affiliateCurrency -> Affiliate { affiliateCurrency, ..} ) <$> f affiliateCurrency+{-# INLINE affiliateCurrencyL #-}++-- | 'affiliatePrevPayout' Lens+affiliatePrevPayoutL :: Lens_' Affiliate (Maybe Double)+affiliatePrevPayoutL f Affiliate{..} = (\affiliatePrevPayout -> Affiliate { affiliatePrevPayout, ..} ) <$> f affiliatePrevPayout+{-# INLINE affiliatePrevPayoutL #-}++-- | 'affiliatePrevTurnover' Lens+affiliatePrevTurnoverL :: Lens_' Affiliate (Maybe Double)+affiliatePrevTurnoverL f Affiliate{..} = (\affiliatePrevTurnover -> Affiliate { affiliatePrevTurnover, ..} ) <$> f affiliatePrevTurnover+{-# INLINE affiliatePrevTurnoverL #-}++-- | 'affiliatePrevComm' Lens+affiliatePrevCommL :: Lens_' Affiliate (Maybe Double)+affiliatePrevCommL f Affiliate{..} = (\affiliatePrevComm -> Affiliate { affiliatePrevComm, ..} ) <$> f affiliatePrevComm+{-# INLINE affiliatePrevCommL #-}++-- | 'affiliatePrevTimestamp' Lens+affiliatePrevTimestampL :: Lens_' Affiliate (Maybe DateTime)+affiliatePrevTimestampL f Affiliate{..} = (\affiliatePrevTimestamp -> Affiliate { affiliatePrevTimestamp, ..} ) <$> f affiliatePrevTimestamp+{-# INLINE affiliatePrevTimestampL #-}++-- | 'affiliateExecTurnover' Lens+affiliateExecTurnoverL :: Lens_' Affiliate (Maybe Double)+affiliateExecTurnoverL f Affiliate{..} = (\affiliateExecTurnover -> Affiliate { affiliateExecTurnover, ..} ) <$> f affiliateExecTurnover+{-# INLINE affiliateExecTurnoverL #-}++-- | 'affiliateExecComm' Lens+affiliateExecCommL :: Lens_' Affiliate (Maybe Double)+affiliateExecCommL f Affiliate{..} = (\affiliateExecComm -> Affiliate { affiliateExecComm, ..} ) <$> f affiliateExecComm+{-# INLINE affiliateExecCommL #-}++-- | 'affiliateTotalReferrals' Lens+affiliateTotalReferralsL :: Lens_' Affiliate (Maybe Double)+affiliateTotalReferralsL f Affiliate{..} = (\affiliateTotalReferrals -> Affiliate { affiliateTotalReferrals, ..} ) <$> f affiliateTotalReferrals+{-# INLINE affiliateTotalReferralsL #-}++-- | 'affiliateTotalTurnover' Lens+affiliateTotalTurnoverL :: Lens_' Affiliate (Maybe Double)+affiliateTotalTurnoverL f Affiliate{..} = (\affiliateTotalTurnover -> Affiliate { affiliateTotalTurnover, ..} ) <$> f affiliateTotalTurnover+{-# INLINE affiliateTotalTurnoverL #-}++-- | 'affiliateTotalComm' Lens+affiliateTotalCommL :: Lens_' Affiliate (Maybe Double)+affiliateTotalCommL f Affiliate{..} = (\affiliateTotalComm -> Affiliate { affiliateTotalComm, ..} ) <$> f affiliateTotalComm+{-# INLINE affiliateTotalCommL #-}++-- | 'affiliatePayoutPcnt' Lens+affiliatePayoutPcntL :: Lens_' Affiliate (Maybe Double)+affiliatePayoutPcntL f Affiliate{..} = (\affiliatePayoutPcnt -> Affiliate { affiliatePayoutPcnt, ..} ) <$> f affiliatePayoutPcnt+{-# INLINE affiliatePayoutPcntL #-}++-- | 'affiliatePendingPayout' Lens+affiliatePendingPayoutL :: Lens_' Affiliate (Maybe Double)+affiliatePendingPayoutL f Affiliate{..} = (\affiliatePendingPayout -> Affiliate { affiliatePendingPayout, ..} ) <$> f affiliatePendingPayout+{-# INLINE affiliatePendingPayoutL #-}++-- | 'affiliateTimestamp' Lens+affiliateTimestampL :: Lens_' Affiliate (Maybe DateTime)+affiliateTimestampL f Affiliate{..} = (\affiliateTimestamp -> Affiliate { affiliateTimestamp, ..} ) <$> f affiliateTimestamp+{-# INLINE affiliateTimestampL #-}++-- | 'affiliateReferrerAccount' Lens+affiliateReferrerAccountL :: Lens_' Affiliate (Maybe Double)+affiliateReferrerAccountL f Affiliate{..} = (\affiliateReferrerAccount -> Affiliate { affiliateReferrerAccount, ..} ) <$> f affiliateReferrerAccount+{-# INLINE affiliateReferrerAccountL #-}++++-- * Announcement++-- | 'announcementId' Lens+announcementIdL :: Lens_' Announcement (Double)+announcementIdL f Announcement{..} = (\announcementId -> Announcement { announcementId, ..} ) <$> f announcementId+{-# INLINE announcementIdL #-}++-- | 'announcementLink' Lens+announcementLinkL :: Lens_' Announcement (Maybe Text)+announcementLinkL f Announcement{..} = (\announcementLink -> Announcement { announcementLink, ..} ) <$> f announcementLink+{-# INLINE announcementLinkL #-}++-- | 'announcementTitle' Lens+announcementTitleL :: Lens_' Announcement (Maybe Text)+announcementTitleL f Announcement{..} = (\announcementTitle -> Announcement { announcementTitle, ..} ) <$> f announcementTitle+{-# INLINE announcementTitleL #-}++-- | 'announcementContent' Lens+announcementContentL :: Lens_' Announcement (Maybe Text)+announcementContentL f Announcement{..} = (\announcementContent -> Announcement { announcementContent, ..} ) <$> f announcementContent+{-# INLINE announcementContentL #-}++-- | 'announcementDate' Lens+announcementDateL :: Lens_' Announcement (Maybe DateTime)+announcementDateL f Announcement{..} = (\announcementDate -> Announcement { announcementDate, ..} ) <$> f announcementDate+{-# INLINE announcementDateL #-}++++-- * Chat++-- | 'chatId' Lens+chatIdL :: Lens_' Chat (Maybe Double)+chatIdL f Chat{..} = (\chatId -> Chat { chatId, ..} ) <$> f chatId+{-# INLINE chatIdL #-}++-- | 'chatDate' Lens+chatDateL :: Lens_' Chat (DateTime)+chatDateL f Chat{..} = (\chatDate -> Chat { chatDate, ..} ) <$> f chatDate+{-# INLINE chatDateL #-}++-- | 'chatUser' Lens+chatUserL :: Lens_' Chat (Text)+chatUserL f Chat{..} = (\chatUser -> Chat { chatUser, ..} ) <$> f chatUser+{-# INLINE chatUserL #-}++-- | 'chatMessage' Lens+chatMessageL :: Lens_' Chat (Text)+chatMessageL f Chat{..} = (\chatMessage -> Chat { chatMessage, ..} ) <$> f chatMessage+{-# INLINE chatMessageL #-}++-- | 'chatHtml' Lens+chatHtmlL :: Lens_' Chat (Text)+chatHtmlL f Chat{..} = (\chatHtml -> Chat { chatHtml, ..} ) <$> f chatHtml+{-# INLINE chatHtmlL #-}++-- | 'chatFromBot' Lens+chatFromBotL :: Lens_' Chat (Maybe Bool)+chatFromBotL f Chat{..} = (\chatFromBot -> Chat { chatFromBot, ..} ) <$> f chatFromBot+{-# INLINE chatFromBotL #-}++-- | 'chatChannelId' Lens+chatChannelIdL :: Lens_' Chat (Maybe Double)+chatChannelIdL f Chat{..} = (\chatChannelId -> Chat { chatChannelId, ..} ) <$> f chatChannelId+{-# INLINE chatChannelIdL #-}++++-- * ChatChannels++-- | 'chatChannelsId' Lens+chatChannelsIdL :: Lens_' ChatChannels (Maybe Double)+chatChannelsIdL f ChatChannels{..} = (\chatChannelsId -> ChatChannels { chatChannelsId, ..} ) <$> f chatChannelsId+{-# INLINE chatChannelsIdL #-}++-- | 'chatChannelsName' Lens+chatChannelsNameL :: Lens_' ChatChannels (Text)+chatChannelsNameL f ChatChannels{..} = (\chatChannelsName -> ChatChannels { chatChannelsName, ..} ) <$> f chatChannelsName+{-# INLINE chatChannelsNameL #-}++++-- * ConnectedUsers++-- | 'connectedUsersUsers' Lens+connectedUsersUsersL :: Lens_' ConnectedUsers (Maybe Double)+connectedUsersUsersL f ConnectedUsers{..} = (\connectedUsersUsers -> ConnectedUsers { connectedUsersUsers, ..} ) <$> f connectedUsersUsers+{-# INLINE connectedUsersUsersL #-}++-- | 'connectedUsersBots' Lens+connectedUsersBotsL :: Lens_' ConnectedUsers (Maybe Double)+connectedUsersBotsL f ConnectedUsers{..} = (\connectedUsersBots -> ConnectedUsers { connectedUsersBots, ..} ) <$> f connectedUsersBots+{-# INLINE connectedUsersBotsL #-}++++-- * Error++-- | 'errorError' Lens+errorErrorL :: Lens_' Error (ErrorError)+errorErrorL f Error{..} = (\errorError -> Error { errorError, ..} ) <$> f errorError+{-# INLINE errorErrorL #-}++++-- * ErrorError++-- | 'errorErrorMessage' Lens+errorErrorMessageL :: Lens_' ErrorError (Maybe Text)+errorErrorMessageL f ErrorError{..} = (\errorErrorMessage -> ErrorError { errorErrorMessage, ..} ) <$> f errorErrorMessage+{-# INLINE errorErrorMessageL #-}++-- | 'errorErrorName' Lens+errorErrorNameL :: Lens_' ErrorError (Maybe Text)+errorErrorNameL f ErrorError{..} = (\errorErrorName -> ErrorError { errorErrorName, ..} ) <$> f errorErrorName+{-# INLINE errorErrorNameL #-}++++-- * Execution++-- | 'executionExecId' Lens+executionExecIdL :: Lens_' Execution (Text)+executionExecIdL f Execution{..} = (\executionExecId -> Execution { executionExecId, ..} ) <$> f executionExecId+{-# INLINE executionExecIdL #-}++-- | 'executionOrderId' Lens+executionOrderIdL :: Lens_' Execution (Maybe Text)+executionOrderIdL f Execution{..} = (\executionOrderId -> Execution { executionOrderId, ..} ) <$> f executionOrderId+{-# INLINE executionOrderIdL #-}++-- | 'executionClOrdId' Lens+executionClOrdIdL :: Lens_' Execution (Maybe Text)+executionClOrdIdL f Execution{..} = (\executionClOrdId -> Execution { executionClOrdId, ..} ) <$> f executionClOrdId+{-# INLINE executionClOrdIdL #-}++-- | 'executionClOrdLinkId' Lens+executionClOrdLinkIdL :: Lens_' Execution (Maybe Text)+executionClOrdLinkIdL f Execution{..} = (\executionClOrdLinkId -> Execution { executionClOrdLinkId, ..} ) <$> f executionClOrdLinkId+{-# INLINE executionClOrdLinkIdL #-}++-- | 'executionAccount' Lens+executionAccountL :: Lens_' Execution (Maybe Double)+executionAccountL f Execution{..} = (\executionAccount -> Execution { executionAccount, ..} ) <$> f executionAccount+{-# INLINE executionAccountL #-}++-- | 'executionSymbol' Lens+executionSymbolL :: Lens_' Execution (Maybe Text)+executionSymbolL f Execution{..} = (\executionSymbol -> Execution { executionSymbol, ..} ) <$> f executionSymbol+{-# INLINE executionSymbolL #-}++-- | 'executionSide' Lens+executionSideL :: Lens_' Execution (Maybe Text)+executionSideL f Execution{..} = (\executionSide -> Execution { executionSide, ..} ) <$> f executionSide+{-# INLINE executionSideL #-}++-- | 'executionLastQty' Lens+executionLastQtyL :: Lens_' Execution (Maybe Double)+executionLastQtyL f Execution{..} = (\executionLastQty -> Execution { executionLastQty, ..} ) <$> f executionLastQty+{-# INLINE executionLastQtyL #-}++-- | 'executionLastPx' Lens+executionLastPxL :: Lens_' Execution (Maybe Double)+executionLastPxL f Execution{..} = (\executionLastPx -> Execution { executionLastPx, ..} ) <$> f executionLastPx+{-# INLINE executionLastPxL #-}++-- | 'executionUnderlyingLastPx' Lens+executionUnderlyingLastPxL :: Lens_' Execution (Maybe Double)+executionUnderlyingLastPxL f Execution{..} = (\executionUnderlyingLastPx -> Execution { executionUnderlyingLastPx, ..} ) <$> f executionUnderlyingLastPx+{-# INLINE executionUnderlyingLastPxL #-}++-- | 'executionLastMkt' Lens+executionLastMktL :: Lens_' Execution (Maybe Text)+executionLastMktL f Execution{..} = (\executionLastMkt -> Execution { executionLastMkt, ..} ) <$> f executionLastMkt+{-# INLINE executionLastMktL #-}++-- | 'executionLastLiquidityInd' Lens+executionLastLiquidityIndL :: Lens_' Execution (Maybe Text)+executionLastLiquidityIndL f Execution{..} = (\executionLastLiquidityInd -> Execution { executionLastLiquidityInd, ..} ) <$> f executionLastLiquidityInd+{-# INLINE executionLastLiquidityIndL #-}++-- | 'executionSimpleOrderQty' Lens+executionSimpleOrderQtyL :: Lens_' Execution (Maybe Double)+executionSimpleOrderQtyL f Execution{..} = (\executionSimpleOrderQty -> Execution { executionSimpleOrderQty, ..} ) <$> f executionSimpleOrderQty+{-# INLINE executionSimpleOrderQtyL #-}++-- | 'executionOrderQty' Lens+executionOrderQtyL :: Lens_' Execution (Maybe Double)+executionOrderQtyL f Execution{..} = (\executionOrderQty -> Execution { executionOrderQty, ..} ) <$> f executionOrderQty+{-# INLINE executionOrderQtyL #-}++-- | 'executionPrice' Lens+executionPriceL :: Lens_' Execution (Maybe Double)+executionPriceL f Execution{..} = (\executionPrice -> Execution { executionPrice, ..} ) <$> f executionPrice+{-# INLINE executionPriceL #-}++-- | 'executionDisplayQty' Lens+executionDisplayQtyL :: Lens_' Execution (Maybe Double)+executionDisplayQtyL f Execution{..} = (\executionDisplayQty -> Execution { executionDisplayQty, ..} ) <$> f executionDisplayQty+{-# INLINE executionDisplayQtyL #-}++-- | 'executionStopPx' Lens+executionStopPxL :: Lens_' Execution (Maybe Double)+executionStopPxL f Execution{..} = (\executionStopPx -> Execution { executionStopPx, ..} ) <$> f executionStopPx+{-# INLINE executionStopPxL #-}++-- | 'executionPegOffsetValue' Lens+executionPegOffsetValueL :: Lens_' Execution (Maybe Double)+executionPegOffsetValueL f Execution{..} = (\executionPegOffsetValue -> Execution { executionPegOffsetValue, ..} ) <$> f executionPegOffsetValue+{-# INLINE executionPegOffsetValueL #-}++-- | 'executionPegPriceType' Lens+executionPegPriceTypeL :: Lens_' Execution (Maybe Text)+executionPegPriceTypeL f Execution{..} = (\executionPegPriceType -> Execution { executionPegPriceType, ..} ) <$> f executionPegPriceType+{-# INLINE executionPegPriceTypeL #-}++-- | 'executionCurrency' Lens+executionCurrencyL :: Lens_' Execution (Maybe Text)+executionCurrencyL f Execution{..} = (\executionCurrency -> Execution { executionCurrency, ..} ) <$> f executionCurrency+{-# INLINE executionCurrencyL #-}++-- | 'executionSettlCurrency' Lens+executionSettlCurrencyL :: Lens_' Execution (Maybe Text)+executionSettlCurrencyL f Execution{..} = (\executionSettlCurrency -> Execution { executionSettlCurrency, ..} ) <$> f executionSettlCurrency+{-# INLINE executionSettlCurrencyL #-}++-- | 'executionExecType' Lens+executionExecTypeL :: Lens_' Execution (Maybe Text)+executionExecTypeL f Execution{..} = (\executionExecType -> Execution { executionExecType, ..} ) <$> f executionExecType+{-# INLINE executionExecTypeL #-}++-- | 'executionOrdType' Lens+executionOrdTypeL :: Lens_' Execution (Maybe Text)+executionOrdTypeL f Execution{..} = (\executionOrdType -> Execution { executionOrdType, ..} ) <$> f executionOrdType+{-# INLINE executionOrdTypeL #-}++-- | 'executionTimeInForce' Lens+executionTimeInForceL :: Lens_' Execution (Maybe Text)+executionTimeInForceL f Execution{..} = (\executionTimeInForce -> Execution { executionTimeInForce, ..} ) <$> f executionTimeInForce+{-# INLINE executionTimeInForceL #-}++-- | 'executionExecInst' Lens+executionExecInstL :: Lens_' Execution (Maybe Text)+executionExecInstL f Execution{..} = (\executionExecInst -> Execution { executionExecInst, ..} ) <$> f executionExecInst+{-# INLINE executionExecInstL #-}++-- | 'executionContingencyType' Lens+executionContingencyTypeL :: Lens_' Execution (Maybe Text)+executionContingencyTypeL f Execution{..} = (\executionContingencyType -> Execution { executionContingencyType, ..} ) <$> f executionContingencyType+{-# INLINE executionContingencyTypeL #-}++-- | 'executionExDestination' Lens+executionExDestinationL :: Lens_' Execution (Maybe Text)+executionExDestinationL f Execution{..} = (\executionExDestination -> Execution { executionExDestination, ..} ) <$> f executionExDestination+{-# INLINE executionExDestinationL #-}++-- | 'executionOrdStatus' Lens+executionOrdStatusL :: Lens_' Execution (Maybe Text)+executionOrdStatusL f Execution{..} = (\executionOrdStatus -> Execution { executionOrdStatus, ..} ) <$> f executionOrdStatus+{-# INLINE executionOrdStatusL #-}++-- | 'executionTriggered' Lens+executionTriggeredL :: Lens_' Execution (Maybe Text)+executionTriggeredL f Execution{..} = (\executionTriggered -> Execution { executionTriggered, ..} ) <$> f executionTriggered+{-# INLINE executionTriggeredL #-}++-- | 'executionWorkingIndicator' Lens+executionWorkingIndicatorL :: Lens_' Execution (Maybe Bool)+executionWorkingIndicatorL f Execution{..} = (\executionWorkingIndicator -> Execution { executionWorkingIndicator, ..} ) <$> f executionWorkingIndicator+{-# INLINE executionWorkingIndicatorL #-}++-- | 'executionOrdRejReason' Lens+executionOrdRejReasonL :: Lens_' Execution (Maybe Text)+executionOrdRejReasonL f Execution{..} = (\executionOrdRejReason -> Execution { executionOrdRejReason, ..} ) <$> f executionOrdRejReason+{-# INLINE executionOrdRejReasonL #-}++-- | 'executionSimpleLeavesQty' Lens+executionSimpleLeavesQtyL :: Lens_' Execution (Maybe Double)+executionSimpleLeavesQtyL f Execution{..} = (\executionSimpleLeavesQty -> Execution { executionSimpleLeavesQty, ..} ) <$> f executionSimpleLeavesQty+{-# INLINE executionSimpleLeavesQtyL #-}++-- | 'executionLeavesQty' Lens+executionLeavesQtyL :: Lens_' Execution (Maybe Double)+executionLeavesQtyL f Execution{..} = (\executionLeavesQty -> Execution { executionLeavesQty, ..} ) <$> f executionLeavesQty+{-# INLINE executionLeavesQtyL #-}++-- | 'executionSimpleCumQty' Lens+executionSimpleCumQtyL :: Lens_' Execution (Maybe Double)+executionSimpleCumQtyL f Execution{..} = (\executionSimpleCumQty -> Execution { executionSimpleCumQty, ..} ) <$> f executionSimpleCumQty+{-# INLINE executionSimpleCumQtyL #-}++-- | 'executionCumQty' Lens+executionCumQtyL :: Lens_' Execution (Maybe Double)+executionCumQtyL f Execution{..} = (\executionCumQty -> Execution { executionCumQty, ..} ) <$> f executionCumQty+{-# INLINE executionCumQtyL #-}++-- | 'executionAvgPx' Lens+executionAvgPxL :: Lens_' Execution (Maybe Double)+executionAvgPxL f Execution{..} = (\executionAvgPx -> Execution { executionAvgPx, ..} ) <$> f executionAvgPx+{-# INLINE executionAvgPxL #-}++-- | 'executionCommission' Lens+executionCommissionL :: Lens_' Execution (Maybe Double)+executionCommissionL f Execution{..} = (\executionCommission -> Execution { executionCommission, ..} ) <$> f executionCommission+{-# INLINE executionCommissionL #-}++-- | 'executionTradePublishIndicator' Lens+executionTradePublishIndicatorL :: Lens_' Execution (Maybe Text)+executionTradePublishIndicatorL f Execution{..} = (\executionTradePublishIndicator -> Execution { executionTradePublishIndicator, ..} ) <$> f executionTradePublishIndicator+{-# INLINE executionTradePublishIndicatorL #-}++-- | 'executionMultiLegReportingType' Lens+executionMultiLegReportingTypeL :: Lens_' Execution (Maybe Text)+executionMultiLegReportingTypeL f Execution{..} = (\executionMultiLegReportingType -> Execution { executionMultiLegReportingType, ..} ) <$> f executionMultiLegReportingType+{-# INLINE executionMultiLegReportingTypeL #-}++-- | 'executionText' Lens+executionTextL :: Lens_' Execution (Maybe Text)+executionTextL f Execution{..} = (\executionText -> Execution { executionText, ..} ) <$> f executionText+{-# INLINE executionTextL #-}++-- | 'executionTrdMatchId' Lens+executionTrdMatchIdL :: Lens_' Execution (Maybe Text)+executionTrdMatchIdL f Execution{..} = (\executionTrdMatchId -> Execution { executionTrdMatchId, ..} ) <$> f executionTrdMatchId+{-# INLINE executionTrdMatchIdL #-}++-- | 'executionExecCost' Lens+executionExecCostL :: Lens_' Execution (Maybe Double)+executionExecCostL f Execution{..} = (\executionExecCost -> Execution { executionExecCost, ..} ) <$> f executionExecCost+{-# INLINE executionExecCostL #-}++-- | 'executionExecComm' Lens+executionExecCommL :: Lens_' Execution (Maybe Double)+executionExecCommL f Execution{..} = (\executionExecComm -> Execution { executionExecComm, ..} ) <$> f executionExecComm+{-# INLINE executionExecCommL #-}++-- | 'executionHomeNotional' Lens+executionHomeNotionalL :: Lens_' Execution (Maybe Double)+executionHomeNotionalL f Execution{..} = (\executionHomeNotional -> Execution { executionHomeNotional, ..} ) <$> f executionHomeNotional+{-# INLINE executionHomeNotionalL #-}++-- | 'executionForeignNotional' Lens+executionForeignNotionalL :: Lens_' Execution (Maybe Double)+executionForeignNotionalL f Execution{..} = (\executionForeignNotional -> Execution { executionForeignNotional, ..} ) <$> f executionForeignNotional+{-# INLINE executionForeignNotionalL #-}++-- | 'executionTransactTime' Lens+executionTransactTimeL :: Lens_' Execution (Maybe DateTime)+executionTransactTimeL f Execution{..} = (\executionTransactTime -> Execution { executionTransactTime, ..} ) <$> f executionTransactTime+{-# INLINE executionTransactTimeL #-}++-- | 'executionTimestamp' Lens+executionTimestampL :: Lens_' Execution (Maybe DateTime)+executionTimestampL f Execution{..} = (\executionTimestamp -> Execution { executionTimestamp, ..} ) <$> f executionTimestamp+{-# INLINE executionTimestampL #-}++++-- * Funding++-- | 'fundingTimestamp' Lens+fundingTimestampL :: Lens_' Funding (DateTime)+fundingTimestampL f Funding{..} = (\fundingTimestamp -> Funding { fundingTimestamp, ..} ) <$> f fundingTimestamp+{-# INLINE fundingTimestampL #-}++-- | 'fundingSymbol' Lens+fundingSymbolL :: Lens_' Funding (Text)+fundingSymbolL f Funding{..} = (\fundingSymbol -> Funding { fundingSymbol, ..} ) <$> f fundingSymbol+{-# INLINE fundingSymbolL #-}++-- | 'fundingFundingInterval' Lens+fundingFundingIntervalL :: Lens_' Funding (Maybe DateTime)+fundingFundingIntervalL f Funding{..} = (\fundingFundingInterval -> Funding { fundingFundingInterval, ..} ) <$> f fundingFundingInterval+{-# INLINE fundingFundingIntervalL #-}++-- | 'fundingFundingRate' Lens+fundingFundingRateL :: Lens_' Funding (Maybe Double)+fundingFundingRateL f Funding{..} = (\fundingFundingRate -> Funding { fundingFundingRate, ..} ) <$> f fundingFundingRate+{-# INLINE fundingFundingRateL #-}++-- | 'fundingFundingRateDaily' Lens+fundingFundingRateDailyL :: Lens_' Funding (Maybe Double)+fundingFundingRateDailyL f Funding{..} = (\fundingFundingRateDaily -> Funding { fundingFundingRateDaily, ..} ) <$> f fundingFundingRateDaily+{-# INLINE fundingFundingRateDailyL #-}++++-- * IndexComposite++-- | 'indexCompositeTimestamp' Lens+indexCompositeTimestampL :: Lens_' IndexComposite (DateTime)+indexCompositeTimestampL f IndexComposite{..} = (\indexCompositeTimestamp -> IndexComposite { indexCompositeTimestamp, ..} ) <$> f indexCompositeTimestamp+{-# INLINE indexCompositeTimestampL #-}++-- | 'indexCompositeSymbol' Lens+indexCompositeSymbolL :: Lens_' IndexComposite (Maybe Text)+indexCompositeSymbolL f IndexComposite{..} = (\indexCompositeSymbol -> IndexComposite { indexCompositeSymbol, ..} ) <$> f indexCompositeSymbol+{-# INLINE indexCompositeSymbolL #-}++-- | 'indexCompositeIndexSymbol' Lens+indexCompositeIndexSymbolL :: Lens_' IndexComposite (Maybe Text)+indexCompositeIndexSymbolL f IndexComposite{..} = (\indexCompositeIndexSymbol -> IndexComposite { indexCompositeIndexSymbol, ..} ) <$> f indexCompositeIndexSymbol+{-# INLINE indexCompositeIndexSymbolL #-}++-- | 'indexCompositeReference' Lens+indexCompositeReferenceL :: Lens_' IndexComposite (Maybe Text)+indexCompositeReferenceL f IndexComposite{..} = (\indexCompositeReference -> IndexComposite { indexCompositeReference, ..} ) <$> f indexCompositeReference+{-# INLINE indexCompositeReferenceL #-}++-- | 'indexCompositeLastPrice' Lens+indexCompositeLastPriceL :: Lens_' IndexComposite (Maybe Double)+indexCompositeLastPriceL f IndexComposite{..} = (\indexCompositeLastPrice -> IndexComposite { indexCompositeLastPrice, ..} ) <$> f indexCompositeLastPrice+{-# INLINE indexCompositeLastPriceL #-}++-- | 'indexCompositeWeight' Lens+indexCompositeWeightL :: Lens_' IndexComposite (Maybe Double)+indexCompositeWeightL f IndexComposite{..} = (\indexCompositeWeight -> IndexComposite { indexCompositeWeight, ..} ) <$> f indexCompositeWeight+{-# INLINE indexCompositeWeightL #-}++-- | 'indexCompositeLogged' Lens+indexCompositeLoggedL :: Lens_' IndexComposite (Maybe DateTime)+indexCompositeLoggedL f IndexComposite{..} = (\indexCompositeLogged -> IndexComposite { indexCompositeLogged, ..} ) <$> f indexCompositeLogged+{-# INLINE indexCompositeLoggedL #-}++++-- * InlineResponse200++-- | 'inlineResponse200Success' Lens+inlineResponse200SuccessL :: Lens_' InlineResponse200 (Maybe Bool)+inlineResponse200SuccessL f InlineResponse200{..} = (\inlineResponse200Success -> InlineResponse200 { inlineResponse200Success, ..} ) <$> f inlineResponse200Success+{-# INLINE inlineResponse200SuccessL #-}++++-- * Instrument++-- | 'instrumentSymbol' Lens+instrumentSymbolL :: Lens_' Instrument (Text)+instrumentSymbolL f Instrument{..} = (\instrumentSymbol -> Instrument { instrumentSymbol, ..} ) <$> f instrumentSymbol+{-# INLINE instrumentSymbolL #-}++-- | 'instrumentRootSymbol' Lens+instrumentRootSymbolL :: Lens_' Instrument (Maybe Text)+instrumentRootSymbolL f Instrument{..} = (\instrumentRootSymbol -> Instrument { instrumentRootSymbol, ..} ) <$> f instrumentRootSymbol+{-# INLINE instrumentRootSymbolL #-}++-- | 'instrumentState' Lens+instrumentStateL :: Lens_' Instrument (Maybe Text)+instrumentStateL f Instrument{..} = (\instrumentState -> Instrument { instrumentState, ..} ) <$> f instrumentState+{-# INLINE instrumentStateL #-}++-- | 'instrumentTyp' Lens+instrumentTypL :: Lens_' Instrument (Maybe Text)+instrumentTypL f Instrument{..} = (\instrumentTyp -> Instrument { instrumentTyp, ..} ) <$> f instrumentTyp+{-# INLINE instrumentTypL #-}++-- | 'instrumentListing' Lens+instrumentListingL :: Lens_' Instrument (Maybe DateTime)+instrumentListingL f Instrument{..} = (\instrumentListing -> Instrument { instrumentListing, ..} ) <$> f instrumentListing+{-# INLINE instrumentListingL #-}++-- | 'instrumentFront' Lens+instrumentFrontL :: Lens_' Instrument (Maybe DateTime)+instrumentFrontL f Instrument{..} = (\instrumentFront -> Instrument { instrumentFront, ..} ) <$> f instrumentFront+{-# INLINE instrumentFrontL #-}++-- | 'instrumentExpiry' Lens+instrumentExpiryL :: Lens_' Instrument (Maybe DateTime)+instrumentExpiryL f Instrument{..} = (\instrumentExpiry -> Instrument { instrumentExpiry, ..} ) <$> f instrumentExpiry+{-# INLINE instrumentExpiryL #-}++-- | 'instrumentSettle' Lens+instrumentSettleL :: Lens_' Instrument (Maybe DateTime)+instrumentSettleL f Instrument{..} = (\instrumentSettle -> Instrument { instrumentSettle, ..} ) <$> f instrumentSettle+{-# INLINE instrumentSettleL #-}++-- | 'instrumentRelistInterval' Lens+instrumentRelistIntervalL :: Lens_' Instrument (Maybe DateTime)+instrumentRelistIntervalL f Instrument{..} = (\instrumentRelistInterval -> Instrument { instrumentRelistInterval, ..} ) <$> f instrumentRelistInterval+{-# INLINE instrumentRelistIntervalL #-}++-- | 'instrumentInverseLeg' Lens+instrumentInverseLegL :: Lens_' Instrument (Maybe Text)+instrumentInverseLegL f Instrument{..} = (\instrumentInverseLeg -> Instrument { instrumentInverseLeg, ..} ) <$> f instrumentInverseLeg+{-# INLINE instrumentInverseLegL #-}++-- | 'instrumentSellLeg' Lens+instrumentSellLegL :: Lens_' Instrument (Maybe Text)+instrumentSellLegL f Instrument{..} = (\instrumentSellLeg -> Instrument { instrumentSellLeg, ..} ) <$> f instrumentSellLeg+{-# INLINE instrumentSellLegL #-}++-- | 'instrumentBuyLeg' Lens+instrumentBuyLegL :: Lens_' Instrument (Maybe Text)+instrumentBuyLegL f Instrument{..} = (\instrumentBuyLeg -> Instrument { instrumentBuyLeg, ..} ) <$> f instrumentBuyLeg+{-# INLINE instrumentBuyLegL #-}++-- | 'instrumentPositionCurrency' Lens+instrumentPositionCurrencyL :: Lens_' Instrument (Maybe Text)+instrumentPositionCurrencyL f Instrument{..} = (\instrumentPositionCurrency -> Instrument { instrumentPositionCurrency, ..} ) <$> f instrumentPositionCurrency+{-# INLINE instrumentPositionCurrencyL #-}++-- | 'instrumentUnderlying' Lens+instrumentUnderlyingL :: Lens_' Instrument (Maybe Text)+instrumentUnderlyingL f Instrument{..} = (\instrumentUnderlying -> Instrument { instrumentUnderlying, ..} ) <$> f instrumentUnderlying+{-# INLINE instrumentUnderlyingL #-}++-- | 'instrumentQuoteCurrency' Lens+instrumentQuoteCurrencyL :: Lens_' Instrument (Maybe Text)+instrumentQuoteCurrencyL f Instrument{..} = (\instrumentQuoteCurrency -> Instrument { instrumentQuoteCurrency, ..} ) <$> f instrumentQuoteCurrency+{-# INLINE instrumentQuoteCurrencyL #-}++-- | 'instrumentUnderlyingSymbol' Lens+instrumentUnderlyingSymbolL :: Lens_' Instrument (Maybe Text)+instrumentUnderlyingSymbolL f Instrument{..} = (\instrumentUnderlyingSymbol -> Instrument { instrumentUnderlyingSymbol, ..} ) <$> f instrumentUnderlyingSymbol+{-# INLINE instrumentUnderlyingSymbolL #-}++-- | 'instrumentReference' Lens+instrumentReferenceL :: Lens_' Instrument (Maybe Text)+instrumentReferenceL f Instrument{..} = (\instrumentReference -> Instrument { instrumentReference, ..} ) <$> f instrumentReference+{-# INLINE instrumentReferenceL #-}++-- | 'instrumentReferenceSymbol' Lens+instrumentReferenceSymbolL :: Lens_' Instrument (Maybe Text)+instrumentReferenceSymbolL f Instrument{..} = (\instrumentReferenceSymbol -> Instrument { instrumentReferenceSymbol, ..} ) <$> f instrumentReferenceSymbol+{-# INLINE instrumentReferenceSymbolL #-}++-- | 'instrumentCalcInterval' Lens+instrumentCalcIntervalL :: Lens_' Instrument (Maybe DateTime)+instrumentCalcIntervalL f Instrument{..} = (\instrumentCalcInterval -> Instrument { instrumentCalcInterval, ..} ) <$> f instrumentCalcInterval+{-# INLINE instrumentCalcIntervalL #-}++-- | 'instrumentPublishInterval' Lens+instrumentPublishIntervalL :: Lens_' Instrument (Maybe DateTime)+instrumentPublishIntervalL f Instrument{..} = (\instrumentPublishInterval -> Instrument { instrumentPublishInterval, ..} ) <$> f instrumentPublishInterval+{-# INLINE instrumentPublishIntervalL #-}++-- | 'instrumentPublishTime' Lens+instrumentPublishTimeL :: Lens_' Instrument (Maybe DateTime)+instrumentPublishTimeL f Instrument{..} = (\instrumentPublishTime -> Instrument { instrumentPublishTime, ..} ) <$> f instrumentPublishTime+{-# INLINE instrumentPublishTimeL #-}++-- | 'instrumentMaxOrderQty' Lens+instrumentMaxOrderQtyL :: Lens_' Instrument (Maybe Double)+instrumentMaxOrderQtyL f Instrument{..} = (\instrumentMaxOrderQty -> Instrument { instrumentMaxOrderQty, ..} ) <$> f instrumentMaxOrderQty+{-# INLINE instrumentMaxOrderQtyL #-}++-- | 'instrumentMaxPrice' Lens+instrumentMaxPriceL :: Lens_' Instrument (Maybe Double)+instrumentMaxPriceL f Instrument{..} = (\instrumentMaxPrice -> Instrument { instrumentMaxPrice, ..} ) <$> f instrumentMaxPrice+{-# INLINE instrumentMaxPriceL #-}++-- | 'instrumentLotSize' Lens+instrumentLotSizeL :: Lens_' Instrument (Maybe Double)+instrumentLotSizeL f Instrument{..} = (\instrumentLotSize -> Instrument { instrumentLotSize, ..} ) <$> f instrumentLotSize+{-# INLINE instrumentLotSizeL #-}++-- | 'instrumentTickSize' Lens+instrumentTickSizeL :: Lens_' Instrument (Maybe Double)+instrumentTickSizeL f Instrument{..} = (\instrumentTickSize -> Instrument { instrumentTickSize, ..} ) <$> f instrumentTickSize+{-# INLINE instrumentTickSizeL #-}++-- | 'instrumentMultiplier' Lens+instrumentMultiplierL :: Lens_' Instrument (Maybe Double)+instrumentMultiplierL f Instrument{..} = (\instrumentMultiplier -> Instrument { instrumentMultiplier, ..} ) <$> f instrumentMultiplier+{-# INLINE instrumentMultiplierL #-}++-- | 'instrumentSettlCurrency' Lens+instrumentSettlCurrencyL :: Lens_' Instrument (Maybe Text)+instrumentSettlCurrencyL f Instrument{..} = (\instrumentSettlCurrency -> Instrument { instrumentSettlCurrency, ..} ) <$> f instrumentSettlCurrency+{-# INLINE instrumentSettlCurrencyL #-}++-- | 'instrumentUnderlyingToPositionMultiplier' Lens+instrumentUnderlyingToPositionMultiplierL :: Lens_' Instrument (Maybe Double)+instrumentUnderlyingToPositionMultiplierL f Instrument{..} = (\instrumentUnderlyingToPositionMultiplier -> Instrument { instrumentUnderlyingToPositionMultiplier, ..} ) <$> f instrumentUnderlyingToPositionMultiplier+{-# INLINE instrumentUnderlyingToPositionMultiplierL #-}++-- | 'instrumentUnderlyingToSettleMultiplier' Lens+instrumentUnderlyingToSettleMultiplierL :: Lens_' Instrument (Maybe Double)+instrumentUnderlyingToSettleMultiplierL f Instrument{..} = (\instrumentUnderlyingToSettleMultiplier -> Instrument { instrumentUnderlyingToSettleMultiplier, ..} ) <$> f instrumentUnderlyingToSettleMultiplier+{-# INLINE instrumentUnderlyingToSettleMultiplierL #-}++-- | 'instrumentQuoteToSettleMultiplier' Lens+instrumentQuoteToSettleMultiplierL :: Lens_' Instrument (Maybe Double)+instrumentQuoteToSettleMultiplierL f Instrument{..} = (\instrumentQuoteToSettleMultiplier -> Instrument { instrumentQuoteToSettleMultiplier, ..} ) <$> f instrumentQuoteToSettleMultiplier+{-# INLINE instrumentQuoteToSettleMultiplierL #-}++-- | 'instrumentIsQuanto' Lens+instrumentIsQuantoL :: Lens_' Instrument (Maybe Bool)+instrumentIsQuantoL f Instrument{..} = (\instrumentIsQuanto -> Instrument { instrumentIsQuanto, ..} ) <$> f instrumentIsQuanto+{-# INLINE instrumentIsQuantoL #-}++-- | 'instrumentIsInverse' Lens+instrumentIsInverseL :: Lens_' Instrument (Maybe Bool)+instrumentIsInverseL f Instrument{..} = (\instrumentIsInverse -> Instrument { instrumentIsInverse, ..} ) <$> f instrumentIsInverse+{-# INLINE instrumentIsInverseL #-}++-- | 'instrumentInitMargin' Lens+instrumentInitMarginL :: Lens_' Instrument (Maybe Double)+instrumentInitMarginL f Instrument{..} = (\instrumentInitMargin -> Instrument { instrumentInitMargin, ..} ) <$> f instrumentInitMargin+{-# INLINE instrumentInitMarginL #-}++-- | 'instrumentMaintMargin' Lens+instrumentMaintMarginL :: Lens_' Instrument (Maybe Double)+instrumentMaintMarginL f Instrument{..} = (\instrumentMaintMargin -> Instrument { instrumentMaintMargin, ..} ) <$> f instrumentMaintMargin+{-# INLINE instrumentMaintMarginL #-}++-- | 'instrumentRiskLimit' Lens+instrumentRiskLimitL :: Lens_' Instrument (Maybe Double)+instrumentRiskLimitL f Instrument{..} = (\instrumentRiskLimit -> Instrument { instrumentRiskLimit, ..} ) <$> f instrumentRiskLimit+{-# INLINE instrumentRiskLimitL #-}++-- | 'instrumentRiskStep' Lens+instrumentRiskStepL :: Lens_' Instrument (Maybe Double)+instrumentRiskStepL f Instrument{..} = (\instrumentRiskStep -> Instrument { instrumentRiskStep, ..} ) <$> f instrumentRiskStep+{-# INLINE instrumentRiskStepL #-}++-- | 'instrumentLimit' Lens+instrumentLimitL :: Lens_' Instrument (Maybe Double)+instrumentLimitL f Instrument{..} = (\instrumentLimit -> Instrument { instrumentLimit, ..} ) <$> f instrumentLimit+{-# INLINE instrumentLimitL #-}++-- | 'instrumentCapped' Lens+instrumentCappedL :: Lens_' Instrument (Maybe Bool)+instrumentCappedL f Instrument{..} = (\instrumentCapped -> Instrument { instrumentCapped, ..} ) <$> f instrumentCapped+{-# INLINE instrumentCappedL #-}++-- | 'instrumentTaxed' Lens+instrumentTaxedL :: Lens_' Instrument (Maybe Bool)+instrumentTaxedL f Instrument{..} = (\instrumentTaxed -> Instrument { instrumentTaxed, ..} ) <$> f instrumentTaxed+{-# INLINE instrumentTaxedL #-}++-- | 'instrumentDeleverage' Lens+instrumentDeleverageL :: Lens_' Instrument (Maybe Bool)+instrumentDeleverageL f Instrument{..} = (\instrumentDeleverage -> Instrument { instrumentDeleverage, ..} ) <$> f instrumentDeleverage+{-# INLINE instrumentDeleverageL #-}++-- | 'instrumentMakerFee' Lens+instrumentMakerFeeL :: Lens_' Instrument (Maybe Double)+instrumentMakerFeeL f Instrument{..} = (\instrumentMakerFee -> Instrument { instrumentMakerFee, ..} ) <$> f instrumentMakerFee+{-# INLINE instrumentMakerFeeL #-}++-- | 'instrumentTakerFee' Lens+instrumentTakerFeeL :: Lens_' Instrument (Maybe Double)+instrumentTakerFeeL f Instrument{..} = (\instrumentTakerFee -> Instrument { instrumentTakerFee, ..} ) <$> f instrumentTakerFee+{-# INLINE instrumentTakerFeeL #-}++-- | 'instrumentSettlementFee' Lens+instrumentSettlementFeeL :: Lens_' Instrument (Maybe Double)+instrumentSettlementFeeL f Instrument{..} = (\instrumentSettlementFee -> Instrument { instrumentSettlementFee, ..} ) <$> f instrumentSettlementFee+{-# INLINE instrumentSettlementFeeL #-}++-- | 'instrumentInsuranceFee' Lens+instrumentInsuranceFeeL :: Lens_' Instrument (Maybe Double)+instrumentInsuranceFeeL f Instrument{..} = (\instrumentInsuranceFee -> Instrument { instrumentInsuranceFee, ..} ) <$> f instrumentInsuranceFee+{-# INLINE instrumentInsuranceFeeL #-}++-- | 'instrumentFundingBaseSymbol' Lens+instrumentFundingBaseSymbolL :: Lens_' Instrument (Maybe Text)+instrumentFundingBaseSymbolL f Instrument{..} = (\instrumentFundingBaseSymbol -> Instrument { instrumentFundingBaseSymbol, ..} ) <$> f instrumentFundingBaseSymbol+{-# INLINE instrumentFundingBaseSymbolL #-}++-- | 'instrumentFundingQuoteSymbol' Lens+instrumentFundingQuoteSymbolL :: Lens_' Instrument (Maybe Text)+instrumentFundingQuoteSymbolL f Instrument{..} = (\instrumentFundingQuoteSymbol -> Instrument { instrumentFundingQuoteSymbol, ..} ) <$> f instrumentFundingQuoteSymbol+{-# INLINE instrumentFundingQuoteSymbolL #-}++-- | 'instrumentFundingPremiumSymbol' Lens+instrumentFundingPremiumSymbolL :: Lens_' Instrument (Maybe Text)+instrumentFundingPremiumSymbolL f Instrument{..} = (\instrumentFundingPremiumSymbol -> Instrument { instrumentFundingPremiumSymbol, ..} ) <$> f instrumentFundingPremiumSymbol+{-# INLINE instrumentFundingPremiumSymbolL #-}++-- | 'instrumentFundingTimestamp' Lens+instrumentFundingTimestampL :: Lens_' Instrument (Maybe DateTime)+instrumentFundingTimestampL f Instrument{..} = (\instrumentFundingTimestamp -> Instrument { instrumentFundingTimestamp, ..} ) <$> f instrumentFundingTimestamp+{-# INLINE instrumentFundingTimestampL #-}++-- | 'instrumentFundingInterval' Lens+instrumentFundingIntervalL :: Lens_' Instrument (Maybe DateTime)+instrumentFundingIntervalL f Instrument{..} = (\instrumentFundingInterval -> Instrument { instrumentFundingInterval, ..} ) <$> f instrumentFundingInterval+{-# INLINE instrumentFundingIntervalL #-}++-- | 'instrumentFundingRate' Lens+instrumentFundingRateL :: Lens_' Instrument (Maybe Double)+instrumentFundingRateL f Instrument{..} = (\instrumentFundingRate -> Instrument { instrumentFundingRate, ..} ) <$> f instrumentFundingRate+{-# INLINE instrumentFundingRateL #-}++-- | 'instrumentIndicativeFundingRate' Lens+instrumentIndicativeFundingRateL :: Lens_' Instrument (Maybe Double)+instrumentIndicativeFundingRateL f Instrument{..} = (\instrumentIndicativeFundingRate -> Instrument { instrumentIndicativeFundingRate, ..} ) <$> f instrumentIndicativeFundingRate+{-# INLINE instrumentIndicativeFundingRateL #-}++-- | 'instrumentRebalanceTimestamp' Lens+instrumentRebalanceTimestampL :: Lens_' Instrument (Maybe DateTime)+instrumentRebalanceTimestampL f Instrument{..} = (\instrumentRebalanceTimestamp -> Instrument { instrumentRebalanceTimestamp, ..} ) <$> f instrumentRebalanceTimestamp+{-# INLINE instrumentRebalanceTimestampL #-}++-- | 'instrumentRebalanceInterval' Lens+instrumentRebalanceIntervalL :: Lens_' Instrument (Maybe DateTime)+instrumentRebalanceIntervalL f Instrument{..} = (\instrumentRebalanceInterval -> Instrument { instrumentRebalanceInterval, ..} ) <$> f instrumentRebalanceInterval+{-# INLINE instrumentRebalanceIntervalL #-}++-- | 'instrumentOpeningTimestamp' Lens+instrumentOpeningTimestampL :: Lens_' Instrument (Maybe DateTime)+instrumentOpeningTimestampL f Instrument{..} = (\instrumentOpeningTimestamp -> Instrument { instrumentOpeningTimestamp, ..} ) <$> f instrumentOpeningTimestamp+{-# INLINE instrumentOpeningTimestampL #-}++-- | 'instrumentClosingTimestamp' Lens+instrumentClosingTimestampL :: Lens_' Instrument (Maybe DateTime)+instrumentClosingTimestampL f Instrument{..} = (\instrumentClosingTimestamp -> Instrument { instrumentClosingTimestamp, ..} ) <$> f instrumentClosingTimestamp+{-# INLINE instrumentClosingTimestampL #-}++-- | 'instrumentSessionInterval' Lens+instrumentSessionIntervalL :: Lens_' Instrument (Maybe DateTime)+instrumentSessionIntervalL f Instrument{..} = (\instrumentSessionInterval -> Instrument { instrumentSessionInterval, ..} ) <$> f instrumentSessionInterval+{-# INLINE instrumentSessionIntervalL #-}++-- | 'instrumentPrevClosePrice' Lens+instrumentPrevClosePriceL :: Lens_' Instrument (Maybe Double)+instrumentPrevClosePriceL f Instrument{..} = (\instrumentPrevClosePrice -> Instrument { instrumentPrevClosePrice, ..} ) <$> f instrumentPrevClosePrice+{-# INLINE instrumentPrevClosePriceL #-}++-- | 'instrumentLimitDownPrice' Lens+instrumentLimitDownPriceL :: Lens_' Instrument (Maybe Double)+instrumentLimitDownPriceL f Instrument{..} = (\instrumentLimitDownPrice -> Instrument { instrumentLimitDownPrice, ..} ) <$> f instrumentLimitDownPrice+{-# INLINE instrumentLimitDownPriceL #-}++-- | 'instrumentLimitUpPrice' Lens+instrumentLimitUpPriceL :: Lens_' Instrument (Maybe Double)+instrumentLimitUpPriceL f Instrument{..} = (\instrumentLimitUpPrice -> Instrument { instrumentLimitUpPrice, ..} ) <$> f instrumentLimitUpPrice+{-# INLINE instrumentLimitUpPriceL #-}++-- | 'instrumentBankruptLimitDownPrice' Lens+instrumentBankruptLimitDownPriceL :: Lens_' Instrument (Maybe Double)+instrumentBankruptLimitDownPriceL f Instrument{..} = (\instrumentBankruptLimitDownPrice -> Instrument { instrumentBankruptLimitDownPrice, ..} ) <$> f instrumentBankruptLimitDownPrice+{-# INLINE instrumentBankruptLimitDownPriceL #-}++-- | 'instrumentBankruptLimitUpPrice' Lens+instrumentBankruptLimitUpPriceL :: Lens_' Instrument (Maybe Double)+instrumentBankruptLimitUpPriceL f Instrument{..} = (\instrumentBankruptLimitUpPrice -> Instrument { instrumentBankruptLimitUpPrice, ..} ) <$> f instrumentBankruptLimitUpPrice+{-# INLINE instrumentBankruptLimitUpPriceL #-}++-- | 'instrumentPrevTotalVolume' Lens+instrumentPrevTotalVolumeL :: Lens_' Instrument (Maybe Double)+instrumentPrevTotalVolumeL f Instrument{..} = (\instrumentPrevTotalVolume -> Instrument { instrumentPrevTotalVolume, ..} ) <$> f instrumentPrevTotalVolume+{-# INLINE instrumentPrevTotalVolumeL #-}++-- | 'instrumentTotalVolume' Lens+instrumentTotalVolumeL :: Lens_' Instrument (Maybe Double)+instrumentTotalVolumeL f Instrument{..} = (\instrumentTotalVolume -> Instrument { instrumentTotalVolume, ..} ) <$> f instrumentTotalVolume+{-# INLINE instrumentTotalVolumeL #-}++-- | 'instrumentVolume' Lens+instrumentVolumeL :: Lens_' Instrument (Maybe Double)+instrumentVolumeL f Instrument{..} = (\instrumentVolume -> Instrument { instrumentVolume, ..} ) <$> f instrumentVolume+{-# INLINE instrumentVolumeL #-}++-- | 'instrumentVolume24h' Lens+instrumentVolume24hL :: Lens_' Instrument (Maybe Double)+instrumentVolume24hL f Instrument{..} = (\instrumentVolume24h -> Instrument { instrumentVolume24h, ..} ) <$> f instrumentVolume24h+{-# INLINE instrumentVolume24hL #-}++-- | 'instrumentPrevTotalTurnover' Lens+instrumentPrevTotalTurnoverL :: Lens_' Instrument (Maybe Double)+instrumentPrevTotalTurnoverL f Instrument{..} = (\instrumentPrevTotalTurnover -> Instrument { instrumentPrevTotalTurnover, ..} ) <$> f instrumentPrevTotalTurnover+{-# INLINE instrumentPrevTotalTurnoverL #-}++-- | 'instrumentTotalTurnover' Lens+instrumentTotalTurnoverL :: Lens_' Instrument (Maybe Double)+instrumentTotalTurnoverL f Instrument{..} = (\instrumentTotalTurnover -> Instrument { instrumentTotalTurnover, ..} ) <$> f instrumentTotalTurnover+{-# INLINE instrumentTotalTurnoverL #-}++-- | 'instrumentTurnover' Lens+instrumentTurnoverL :: Lens_' Instrument (Maybe Double)+instrumentTurnoverL f Instrument{..} = (\instrumentTurnover -> Instrument { instrumentTurnover, ..} ) <$> f instrumentTurnover+{-# INLINE instrumentTurnoverL #-}++-- | 'instrumentTurnover24h' Lens+instrumentTurnover24hL :: Lens_' Instrument (Maybe Double)+instrumentTurnover24hL f Instrument{..} = (\instrumentTurnover24h -> Instrument { instrumentTurnover24h, ..} ) <$> f instrumentTurnover24h+{-# INLINE instrumentTurnover24hL #-}++-- | 'instrumentPrevPrice24h' Lens+instrumentPrevPrice24hL :: Lens_' Instrument (Maybe Double)+instrumentPrevPrice24hL f Instrument{..} = (\instrumentPrevPrice24h -> Instrument { instrumentPrevPrice24h, ..} ) <$> f instrumentPrevPrice24h+{-# INLINE instrumentPrevPrice24hL #-}++-- | 'instrumentVwap' Lens+instrumentVwapL :: Lens_' Instrument (Maybe Double)+instrumentVwapL f Instrument{..} = (\instrumentVwap -> Instrument { instrumentVwap, ..} ) <$> f instrumentVwap+{-# INLINE instrumentVwapL #-}++-- | 'instrumentHighPrice' Lens+instrumentHighPriceL :: Lens_' Instrument (Maybe Double)+instrumentHighPriceL f Instrument{..} = (\instrumentHighPrice -> Instrument { instrumentHighPrice, ..} ) <$> f instrumentHighPrice+{-# INLINE instrumentHighPriceL #-}++-- | 'instrumentLowPrice' Lens+instrumentLowPriceL :: Lens_' Instrument (Maybe Double)+instrumentLowPriceL f Instrument{..} = (\instrumentLowPrice -> Instrument { instrumentLowPrice, ..} ) <$> f instrumentLowPrice+{-# INLINE instrumentLowPriceL #-}++-- | 'instrumentLastPrice' Lens+instrumentLastPriceL :: Lens_' Instrument (Maybe Double)+instrumentLastPriceL f Instrument{..} = (\instrumentLastPrice -> Instrument { instrumentLastPrice, ..} ) <$> f instrumentLastPrice+{-# INLINE instrumentLastPriceL #-}++-- | 'instrumentLastPriceProtected' Lens+instrumentLastPriceProtectedL :: Lens_' Instrument (Maybe Double)+instrumentLastPriceProtectedL f Instrument{..} = (\instrumentLastPriceProtected -> Instrument { instrumentLastPriceProtected, ..} ) <$> f instrumentLastPriceProtected+{-# INLINE instrumentLastPriceProtectedL #-}++-- | 'instrumentLastTickDirection' Lens+instrumentLastTickDirectionL :: Lens_' Instrument (Maybe Text)+instrumentLastTickDirectionL f Instrument{..} = (\instrumentLastTickDirection -> Instrument { instrumentLastTickDirection, ..} ) <$> f instrumentLastTickDirection+{-# INLINE instrumentLastTickDirectionL #-}++-- | 'instrumentLastChangePcnt' Lens+instrumentLastChangePcntL :: Lens_' Instrument (Maybe Double)+instrumentLastChangePcntL f Instrument{..} = (\instrumentLastChangePcnt -> Instrument { instrumentLastChangePcnt, ..} ) <$> f instrumentLastChangePcnt+{-# INLINE instrumentLastChangePcntL #-}++-- | 'instrumentBidPrice' Lens+instrumentBidPriceL :: Lens_' Instrument (Maybe Double)+instrumentBidPriceL f Instrument{..} = (\instrumentBidPrice -> Instrument { instrumentBidPrice, ..} ) <$> f instrumentBidPrice+{-# INLINE instrumentBidPriceL #-}++-- | 'instrumentMidPrice' Lens+instrumentMidPriceL :: Lens_' Instrument (Maybe Double)+instrumentMidPriceL f Instrument{..} = (\instrumentMidPrice -> Instrument { instrumentMidPrice, ..} ) <$> f instrumentMidPrice+{-# INLINE instrumentMidPriceL #-}++-- | 'instrumentAskPrice' Lens+instrumentAskPriceL :: Lens_' Instrument (Maybe Double)+instrumentAskPriceL f Instrument{..} = (\instrumentAskPrice -> Instrument { instrumentAskPrice, ..} ) <$> f instrumentAskPrice+{-# INLINE instrumentAskPriceL #-}++-- | 'instrumentImpactBidPrice' Lens+instrumentImpactBidPriceL :: Lens_' Instrument (Maybe Double)+instrumentImpactBidPriceL f Instrument{..} = (\instrumentImpactBidPrice -> Instrument { instrumentImpactBidPrice, ..} ) <$> f instrumentImpactBidPrice+{-# INLINE instrumentImpactBidPriceL #-}++-- | 'instrumentImpactMidPrice' Lens+instrumentImpactMidPriceL :: Lens_' Instrument (Maybe Double)+instrumentImpactMidPriceL f Instrument{..} = (\instrumentImpactMidPrice -> Instrument { instrumentImpactMidPrice, ..} ) <$> f instrumentImpactMidPrice+{-# INLINE instrumentImpactMidPriceL #-}++-- | 'instrumentImpactAskPrice' Lens+instrumentImpactAskPriceL :: Lens_' Instrument (Maybe Double)+instrumentImpactAskPriceL f Instrument{..} = (\instrumentImpactAskPrice -> Instrument { instrumentImpactAskPrice, ..} ) <$> f instrumentImpactAskPrice+{-# INLINE instrumentImpactAskPriceL #-}++-- | 'instrumentHasLiquidity' Lens+instrumentHasLiquidityL :: Lens_' Instrument (Maybe Bool)+instrumentHasLiquidityL f Instrument{..} = (\instrumentHasLiquidity -> Instrument { instrumentHasLiquidity, ..} ) <$> f instrumentHasLiquidity+{-# INLINE instrumentHasLiquidityL #-}++-- | 'instrumentOpenInterest' Lens+instrumentOpenInterestL :: Lens_' Instrument (Maybe Double)+instrumentOpenInterestL f Instrument{..} = (\instrumentOpenInterest -> Instrument { instrumentOpenInterest, ..} ) <$> f instrumentOpenInterest+{-# INLINE instrumentOpenInterestL #-}++-- | 'instrumentOpenValue' Lens+instrumentOpenValueL :: Lens_' Instrument (Maybe Double)+instrumentOpenValueL f Instrument{..} = (\instrumentOpenValue -> Instrument { instrumentOpenValue, ..} ) <$> f instrumentOpenValue+{-# INLINE instrumentOpenValueL #-}++-- | 'instrumentFairMethod' Lens+instrumentFairMethodL :: Lens_' Instrument (Maybe Text)+instrumentFairMethodL f Instrument{..} = (\instrumentFairMethod -> Instrument { instrumentFairMethod, ..} ) <$> f instrumentFairMethod+{-# INLINE instrumentFairMethodL #-}++-- | 'instrumentFairBasisRate' Lens+instrumentFairBasisRateL :: Lens_' Instrument (Maybe Double)+instrumentFairBasisRateL f Instrument{..} = (\instrumentFairBasisRate -> Instrument { instrumentFairBasisRate, ..} ) <$> f instrumentFairBasisRate+{-# INLINE instrumentFairBasisRateL #-}++-- | 'instrumentFairBasis' Lens+instrumentFairBasisL :: Lens_' Instrument (Maybe Double)+instrumentFairBasisL f Instrument{..} = (\instrumentFairBasis -> Instrument { instrumentFairBasis, ..} ) <$> f instrumentFairBasis+{-# INLINE instrumentFairBasisL #-}++-- | 'instrumentFairPrice' Lens+instrumentFairPriceL :: Lens_' Instrument (Maybe Double)+instrumentFairPriceL f Instrument{..} = (\instrumentFairPrice -> Instrument { instrumentFairPrice, ..} ) <$> f instrumentFairPrice+{-# INLINE instrumentFairPriceL #-}++-- | 'instrumentMarkMethod' Lens+instrumentMarkMethodL :: Lens_' Instrument (Maybe Text)+instrumentMarkMethodL f Instrument{..} = (\instrumentMarkMethod -> Instrument { instrumentMarkMethod, ..} ) <$> f instrumentMarkMethod+{-# INLINE instrumentMarkMethodL #-}++-- | 'instrumentMarkPrice' Lens+instrumentMarkPriceL :: Lens_' Instrument (Maybe Double)+instrumentMarkPriceL f Instrument{..} = (\instrumentMarkPrice -> Instrument { instrumentMarkPrice, ..} ) <$> f instrumentMarkPrice+{-# INLINE instrumentMarkPriceL #-}++-- | 'instrumentIndicativeTaxRate' Lens+instrumentIndicativeTaxRateL :: Lens_' Instrument (Maybe Double)+instrumentIndicativeTaxRateL f Instrument{..} = (\instrumentIndicativeTaxRate -> Instrument { instrumentIndicativeTaxRate, ..} ) <$> f instrumentIndicativeTaxRate+{-# INLINE instrumentIndicativeTaxRateL #-}++-- | 'instrumentIndicativeSettlePrice' Lens+instrumentIndicativeSettlePriceL :: Lens_' Instrument (Maybe Double)+instrumentIndicativeSettlePriceL f Instrument{..} = (\instrumentIndicativeSettlePrice -> Instrument { instrumentIndicativeSettlePrice, ..} ) <$> f instrumentIndicativeSettlePrice+{-# INLINE instrumentIndicativeSettlePriceL #-}++-- | 'instrumentSettledPrice' Lens+instrumentSettledPriceL :: Lens_' Instrument (Maybe Double)+instrumentSettledPriceL f Instrument{..} = (\instrumentSettledPrice -> Instrument { instrumentSettledPrice, ..} ) <$> f instrumentSettledPrice+{-# INLINE instrumentSettledPriceL #-}++-- | 'instrumentTimestamp' Lens+instrumentTimestampL :: Lens_' Instrument (Maybe DateTime)+instrumentTimestampL f Instrument{..} = (\instrumentTimestamp -> Instrument { instrumentTimestamp, ..} ) <$> f instrumentTimestamp+{-# INLINE instrumentTimestampL #-}++++-- * InstrumentInterval++-- | 'instrumentIntervalIntervals' Lens+instrumentIntervalIntervalsL :: Lens_' InstrumentInterval ([Text])+instrumentIntervalIntervalsL f InstrumentInterval{..} = (\instrumentIntervalIntervals -> InstrumentInterval { instrumentIntervalIntervals, ..} ) <$> f instrumentIntervalIntervals+{-# INLINE instrumentIntervalIntervalsL #-}++-- | 'instrumentIntervalSymbols' Lens+instrumentIntervalSymbolsL :: Lens_' InstrumentInterval ([Text])+instrumentIntervalSymbolsL f InstrumentInterval{..} = (\instrumentIntervalSymbols -> InstrumentInterval { instrumentIntervalSymbols, ..} ) <$> f instrumentIntervalSymbols+{-# INLINE instrumentIntervalSymbolsL #-}++++-- * Insurance++-- | 'insuranceCurrency' Lens+insuranceCurrencyL :: Lens_' Insurance (Text)+insuranceCurrencyL f Insurance{..} = (\insuranceCurrency -> Insurance { insuranceCurrency, ..} ) <$> f insuranceCurrency+{-# INLINE insuranceCurrencyL #-}++-- | 'insuranceTimestamp' Lens+insuranceTimestampL :: Lens_' Insurance (DateTime)+insuranceTimestampL f Insurance{..} = (\insuranceTimestamp -> Insurance { insuranceTimestamp, ..} ) <$> f insuranceTimestamp+{-# INLINE insuranceTimestampL #-}++-- | 'insuranceWalletBalance' Lens+insuranceWalletBalanceL :: Lens_' Insurance (Maybe Double)+insuranceWalletBalanceL f Insurance{..} = (\insuranceWalletBalance -> Insurance { insuranceWalletBalance, ..} ) <$> f insuranceWalletBalance+{-# INLINE insuranceWalletBalanceL #-}++++-- * Leaderboard++-- | 'leaderboardName' Lens+leaderboardNameL :: Lens_' Leaderboard (Text)+leaderboardNameL f Leaderboard{..} = (\leaderboardName -> Leaderboard { leaderboardName, ..} ) <$> f leaderboardName+{-# INLINE leaderboardNameL #-}++-- | 'leaderboardIsRealName' Lens+leaderboardIsRealNameL :: Lens_' Leaderboard (Maybe Bool)+leaderboardIsRealNameL f Leaderboard{..} = (\leaderboardIsRealName -> Leaderboard { leaderboardIsRealName, ..} ) <$> f leaderboardIsRealName+{-# INLINE leaderboardIsRealNameL #-}++-- | 'leaderboardIsMe' Lens+leaderboardIsMeL :: Lens_' Leaderboard (Maybe Bool)+leaderboardIsMeL f Leaderboard{..} = (\leaderboardIsMe -> Leaderboard { leaderboardIsMe, ..} ) <$> f leaderboardIsMe+{-# INLINE leaderboardIsMeL #-}++-- | 'leaderboardProfit' Lens+leaderboardProfitL :: Lens_' Leaderboard (Maybe Double)+leaderboardProfitL f Leaderboard{..} = (\leaderboardProfit -> Leaderboard { leaderboardProfit, ..} ) <$> f leaderboardProfit+{-# INLINE leaderboardProfitL #-}++++-- * Liquidation++-- | 'liquidationOrderId' Lens+liquidationOrderIdL :: Lens_' Liquidation (Text)+liquidationOrderIdL f Liquidation{..} = (\liquidationOrderId -> Liquidation { liquidationOrderId, ..} ) <$> f liquidationOrderId+{-# INLINE liquidationOrderIdL #-}++-- | 'liquidationSymbol' Lens+liquidationSymbolL :: Lens_' Liquidation (Maybe Text)+liquidationSymbolL f Liquidation{..} = (\liquidationSymbol -> Liquidation { liquidationSymbol, ..} ) <$> f liquidationSymbol+{-# INLINE liquidationSymbolL #-}++-- | 'liquidationSide' Lens+liquidationSideL :: Lens_' Liquidation (Maybe Text)+liquidationSideL f Liquidation{..} = (\liquidationSide -> Liquidation { liquidationSide, ..} ) <$> f liquidationSide+{-# INLINE liquidationSideL #-}++-- | 'liquidationPrice' Lens+liquidationPriceL :: Lens_' Liquidation (Maybe Double)+liquidationPriceL f Liquidation{..} = (\liquidationPrice -> Liquidation { liquidationPrice, ..} ) <$> f liquidationPrice+{-# INLINE liquidationPriceL #-}++-- | 'liquidationLeavesQty' Lens+liquidationLeavesQtyL :: Lens_' Liquidation (Maybe Double)+liquidationLeavesQtyL f Liquidation{..} = (\liquidationLeavesQty -> Liquidation { liquidationLeavesQty, ..} ) <$> f liquidationLeavesQty+{-# INLINE liquidationLeavesQtyL #-}++++-- * Margin++-- | 'marginAccount' Lens+marginAccountL :: Lens_' Margin (Double)+marginAccountL f Margin{..} = (\marginAccount -> Margin { marginAccount, ..} ) <$> f marginAccount+{-# INLINE marginAccountL #-}++-- | 'marginCurrency' Lens+marginCurrencyL :: Lens_' Margin (Text)+marginCurrencyL f Margin{..} = (\marginCurrency -> Margin { marginCurrency, ..} ) <$> f marginCurrency+{-# INLINE marginCurrencyL #-}++-- | 'marginRiskLimit' Lens+marginRiskLimitL :: Lens_' Margin (Maybe Double)+marginRiskLimitL f Margin{..} = (\marginRiskLimit -> Margin { marginRiskLimit, ..} ) <$> f marginRiskLimit+{-# INLINE marginRiskLimitL #-}++-- | 'marginPrevState' Lens+marginPrevStateL :: Lens_' Margin (Maybe Text)+marginPrevStateL f Margin{..} = (\marginPrevState -> Margin { marginPrevState, ..} ) <$> f marginPrevState+{-# INLINE marginPrevStateL #-}++-- | 'marginState' Lens+marginStateL :: Lens_' Margin (Maybe Text)+marginStateL f Margin{..} = (\marginState -> Margin { marginState, ..} ) <$> f marginState+{-# INLINE marginStateL #-}++-- | 'marginAction' Lens+marginActionL :: Lens_' Margin (Maybe Text)+marginActionL f Margin{..} = (\marginAction -> Margin { marginAction, ..} ) <$> f marginAction+{-# INLINE marginActionL #-}++-- | 'marginAmount' Lens+marginAmountL :: Lens_' Margin (Maybe Double)+marginAmountL f Margin{..} = (\marginAmount -> Margin { marginAmount, ..} ) <$> f marginAmount+{-# INLINE marginAmountL #-}++-- | 'marginPendingCredit' Lens+marginPendingCreditL :: Lens_' Margin (Maybe Double)+marginPendingCreditL f Margin{..} = (\marginPendingCredit -> Margin { marginPendingCredit, ..} ) <$> f marginPendingCredit+{-# INLINE marginPendingCreditL #-}++-- | 'marginPendingDebit' Lens+marginPendingDebitL :: Lens_' Margin (Maybe Double)+marginPendingDebitL f Margin{..} = (\marginPendingDebit -> Margin { marginPendingDebit, ..} ) <$> f marginPendingDebit+{-# INLINE marginPendingDebitL #-}++-- | 'marginConfirmedDebit' Lens+marginConfirmedDebitL :: Lens_' Margin (Maybe Double)+marginConfirmedDebitL f Margin{..} = (\marginConfirmedDebit -> Margin { marginConfirmedDebit, ..} ) <$> f marginConfirmedDebit+{-# INLINE marginConfirmedDebitL #-}++-- | 'marginPrevRealisedPnl' Lens+marginPrevRealisedPnlL :: Lens_' Margin (Maybe Double)+marginPrevRealisedPnlL f Margin{..} = (\marginPrevRealisedPnl -> Margin { marginPrevRealisedPnl, ..} ) <$> f marginPrevRealisedPnl+{-# INLINE marginPrevRealisedPnlL #-}++-- | 'marginPrevUnrealisedPnl' Lens+marginPrevUnrealisedPnlL :: Lens_' Margin (Maybe Double)+marginPrevUnrealisedPnlL f Margin{..} = (\marginPrevUnrealisedPnl -> Margin { marginPrevUnrealisedPnl, ..} ) <$> f marginPrevUnrealisedPnl+{-# INLINE marginPrevUnrealisedPnlL #-}++-- | 'marginGrossComm' Lens+marginGrossCommL :: Lens_' Margin (Maybe Double)+marginGrossCommL f Margin{..} = (\marginGrossComm -> Margin { marginGrossComm, ..} ) <$> f marginGrossComm+{-# INLINE marginGrossCommL #-}++-- | 'marginGrossOpenCost' Lens+marginGrossOpenCostL :: Lens_' Margin (Maybe Double)+marginGrossOpenCostL f Margin{..} = (\marginGrossOpenCost -> Margin { marginGrossOpenCost, ..} ) <$> f marginGrossOpenCost+{-# INLINE marginGrossOpenCostL #-}++-- | 'marginGrossOpenPremium' Lens+marginGrossOpenPremiumL :: Lens_' Margin (Maybe Double)+marginGrossOpenPremiumL f Margin{..} = (\marginGrossOpenPremium -> Margin { marginGrossOpenPremium, ..} ) <$> f marginGrossOpenPremium+{-# INLINE marginGrossOpenPremiumL #-}++-- | 'marginGrossExecCost' Lens+marginGrossExecCostL :: Lens_' Margin (Maybe Double)+marginGrossExecCostL f Margin{..} = (\marginGrossExecCost -> Margin { marginGrossExecCost, ..} ) <$> f marginGrossExecCost+{-# INLINE marginGrossExecCostL #-}++-- | 'marginGrossMarkValue' Lens+marginGrossMarkValueL :: Lens_' Margin (Maybe Double)+marginGrossMarkValueL f Margin{..} = (\marginGrossMarkValue -> Margin { marginGrossMarkValue, ..} ) <$> f marginGrossMarkValue+{-# INLINE marginGrossMarkValueL #-}++-- | 'marginRiskValue' Lens+marginRiskValueL :: Lens_' Margin (Maybe Double)+marginRiskValueL f Margin{..} = (\marginRiskValue -> Margin { marginRiskValue, ..} ) <$> f marginRiskValue+{-# INLINE marginRiskValueL #-}++-- | 'marginTaxableMargin' Lens+marginTaxableMarginL :: Lens_' Margin (Maybe Double)+marginTaxableMarginL f Margin{..} = (\marginTaxableMargin -> Margin { marginTaxableMargin, ..} ) <$> f marginTaxableMargin+{-# INLINE marginTaxableMarginL #-}++-- | 'marginInitMargin' Lens+marginInitMarginL :: Lens_' Margin (Maybe Double)+marginInitMarginL f Margin{..} = (\marginInitMargin -> Margin { marginInitMargin, ..} ) <$> f marginInitMargin+{-# INLINE marginInitMarginL #-}++-- | 'marginMaintMargin' Lens+marginMaintMarginL :: Lens_' Margin (Maybe Double)+marginMaintMarginL f Margin{..} = (\marginMaintMargin -> Margin { marginMaintMargin, ..} ) <$> f marginMaintMargin+{-# INLINE marginMaintMarginL #-}++-- | 'marginSessionMargin' Lens+marginSessionMarginL :: Lens_' Margin (Maybe Double)+marginSessionMarginL f Margin{..} = (\marginSessionMargin -> Margin { marginSessionMargin, ..} ) <$> f marginSessionMargin+{-# INLINE marginSessionMarginL #-}++-- | 'marginTargetExcessMargin' Lens+marginTargetExcessMarginL :: Lens_' Margin (Maybe Double)+marginTargetExcessMarginL f Margin{..} = (\marginTargetExcessMargin -> Margin { marginTargetExcessMargin, ..} ) <$> f marginTargetExcessMargin+{-# INLINE marginTargetExcessMarginL #-}++-- | 'marginVarMargin' Lens+marginVarMarginL :: Lens_' Margin (Maybe Double)+marginVarMarginL f Margin{..} = (\marginVarMargin -> Margin { marginVarMargin, ..} ) <$> f marginVarMargin+{-# INLINE marginVarMarginL #-}++-- | 'marginRealisedPnl' Lens+marginRealisedPnlL :: Lens_' Margin (Maybe Double)+marginRealisedPnlL f Margin{..} = (\marginRealisedPnl -> Margin { marginRealisedPnl, ..} ) <$> f marginRealisedPnl+{-# INLINE marginRealisedPnlL #-}++-- | 'marginUnrealisedPnl' Lens+marginUnrealisedPnlL :: Lens_' Margin (Maybe Double)+marginUnrealisedPnlL f Margin{..} = (\marginUnrealisedPnl -> Margin { marginUnrealisedPnl, ..} ) <$> f marginUnrealisedPnl+{-# INLINE marginUnrealisedPnlL #-}++-- | 'marginIndicativeTax' Lens+marginIndicativeTaxL :: Lens_' Margin (Maybe Double)+marginIndicativeTaxL f Margin{..} = (\marginIndicativeTax -> Margin { marginIndicativeTax, ..} ) <$> f marginIndicativeTax+{-# INLINE marginIndicativeTaxL #-}++-- | 'marginUnrealisedProfit' Lens+marginUnrealisedProfitL :: Lens_' Margin (Maybe Double)+marginUnrealisedProfitL f Margin{..} = (\marginUnrealisedProfit -> Margin { marginUnrealisedProfit, ..} ) <$> f marginUnrealisedProfit+{-# INLINE marginUnrealisedProfitL #-}++-- | 'marginSyntheticMargin' Lens+marginSyntheticMarginL :: Lens_' Margin (Maybe Double)+marginSyntheticMarginL f Margin{..} = (\marginSyntheticMargin -> Margin { marginSyntheticMargin, ..} ) <$> f marginSyntheticMargin+{-# INLINE marginSyntheticMarginL #-}++-- | 'marginWalletBalance' Lens+marginWalletBalanceL :: Lens_' Margin (Maybe Double)+marginWalletBalanceL f Margin{..} = (\marginWalletBalance -> Margin { marginWalletBalance, ..} ) <$> f marginWalletBalance+{-# INLINE marginWalletBalanceL #-}++-- | 'marginMarginBalance' Lens+marginMarginBalanceL :: Lens_' Margin (Maybe Double)+marginMarginBalanceL f Margin{..} = (\marginMarginBalance -> Margin { marginMarginBalance, ..} ) <$> f marginMarginBalance+{-# INLINE marginMarginBalanceL #-}++-- | 'marginMarginBalancePcnt' Lens+marginMarginBalancePcntL :: Lens_' Margin (Maybe Double)+marginMarginBalancePcntL f Margin{..} = (\marginMarginBalancePcnt -> Margin { marginMarginBalancePcnt, ..} ) <$> f marginMarginBalancePcnt+{-# INLINE marginMarginBalancePcntL #-}++-- | 'marginMarginLeverage' Lens+marginMarginLeverageL :: Lens_' Margin (Maybe Double)+marginMarginLeverageL f Margin{..} = (\marginMarginLeverage -> Margin { marginMarginLeverage, ..} ) <$> f marginMarginLeverage+{-# INLINE marginMarginLeverageL #-}++-- | 'marginMarginUsedPcnt' Lens+marginMarginUsedPcntL :: Lens_' Margin (Maybe Double)+marginMarginUsedPcntL f Margin{..} = (\marginMarginUsedPcnt -> Margin { marginMarginUsedPcnt, ..} ) <$> f marginMarginUsedPcnt+{-# INLINE marginMarginUsedPcntL #-}++-- | 'marginExcessMargin' Lens+marginExcessMarginL :: Lens_' Margin (Maybe Double)+marginExcessMarginL f Margin{..} = (\marginExcessMargin -> Margin { marginExcessMargin, ..} ) <$> f marginExcessMargin+{-# INLINE marginExcessMarginL #-}++-- | 'marginExcessMarginPcnt' Lens+marginExcessMarginPcntL :: Lens_' Margin (Maybe Double)+marginExcessMarginPcntL f Margin{..} = (\marginExcessMarginPcnt -> Margin { marginExcessMarginPcnt, ..} ) <$> f marginExcessMarginPcnt+{-# INLINE marginExcessMarginPcntL #-}++-- | 'marginAvailableMargin' Lens+marginAvailableMarginL :: Lens_' Margin (Maybe Double)+marginAvailableMarginL f Margin{..} = (\marginAvailableMargin -> Margin { marginAvailableMargin, ..} ) <$> f marginAvailableMargin+{-# INLINE marginAvailableMarginL #-}++-- | 'marginWithdrawableMargin' Lens+marginWithdrawableMarginL :: Lens_' Margin (Maybe Double)+marginWithdrawableMarginL f Margin{..} = (\marginWithdrawableMargin -> Margin { marginWithdrawableMargin, ..} ) <$> f marginWithdrawableMargin+{-# INLINE marginWithdrawableMarginL #-}++-- | 'marginTimestamp' Lens+marginTimestampL :: Lens_' Margin (Maybe DateTime)+marginTimestampL f Margin{..} = (\marginTimestamp -> Margin { marginTimestamp, ..} ) <$> f marginTimestamp+{-# INLINE marginTimestampL #-}++-- | 'marginGrossLastValue' Lens+marginGrossLastValueL :: Lens_' Margin (Maybe Double)+marginGrossLastValueL f Margin{..} = (\marginGrossLastValue -> Margin { marginGrossLastValue, ..} ) <$> f marginGrossLastValue+{-# INLINE marginGrossLastValueL #-}++-- | 'marginCommission' Lens+marginCommissionL :: Lens_' Margin (Maybe Double)+marginCommissionL f Margin{..} = (\marginCommission -> Margin { marginCommission, ..} ) <$> f marginCommission+{-# INLINE marginCommissionL #-}++++-- * Notification++-- | 'notificationId' Lens+notificationIdL :: Lens_' Notification (Maybe Double)+notificationIdL f Notification{..} = (\notificationId -> Notification { notificationId, ..} ) <$> f notificationId+{-# INLINE notificationIdL #-}++-- | 'notificationDate' Lens+notificationDateL :: Lens_' Notification (DateTime)+notificationDateL f Notification{..} = (\notificationDate -> Notification { notificationDate, ..} ) <$> f notificationDate+{-# INLINE notificationDateL #-}++-- | 'notificationTitle' Lens+notificationTitleL :: Lens_' Notification (Text)+notificationTitleL f Notification{..} = (\notificationTitle -> Notification { notificationTitle, ..} ) <$> f notificationTitle+{-# INLINE notificationTitleL #-}++-- | 'notificationBody' Lens+notificationBodyL :: Lens_' Notification (Text)+notificationBodyL f Notification{..} = (\notificationBody -> Notification { notificationBody, ..} ) <$> f notificationBody+{-# INLINE notificationBodyL #-}++-- | 'notificationTtl' Lens+notificationTtlL :: Lens_' Notification (Double)+notificationTtlL f Notification{..} = (\notificationTtl -> Notification { notificationTtl, ..} ) <$> f notificationTtl+{-# INLINE notificationTtlL #-}++-- | 'notificationType' Lens+notificationTypeL :: Lens_' Notification (Maybe E'Type)+notificationTypeL f Notification{..} = (\notificationType -> Notification { notificationType, ..} ) <$> f notificationType+{-# INLINE notificationTypeL #-}++-- | 'notificationClosable' Lens+notificationClosableL :: Lens_' Notification (Maybe Bool)+notificationClosableL f Notification{..} = (\notificationClosable -> Notification { notificationClosable, ..} ) <$> f notificationClosable+{-# INLINE notificationClosableL #-}++-- | 'notificationPersist' Lens+notificationPersistL :: Lens_' Notification (Maybe Bool)+notificationPersistL f Notification{..} = (\notificationPersist -> Notification { notificationPersist, ..} ) <$> f notificationPersist+{-# INLINE notificationPersistL #-}++-- | 'notificationWaitForVisibility' Lens+notificationWaitForVisibilityL :: Lens_' Notification (Maybe Bool)+notificationWaitForVisibilityL f Notification{..} = (\notificationWaitForVisibility -> Notification { notificationWaitForVisibility, ..} ) <$> f notificationWaitForVisibility+{-# INLINE notificationWaitForVisibilityL #-}++-- | 'notificationSound' Lens+notificationSoundL :: Lens_' Notification (Maybe Text)+notificationSoundL f Notification{..} = (\notificationSound -> Notification { notificationSound, ..} ) <$> f notificationSound+{-# INLINE notificationSoundL #-}++++-- * Order++-- | 'orderOrderId' Lens+orderOrderIdL :: Lens_' Order (Text)+orderOrderIdL f Order{..} = (\orderOrderId -> Order { orderOrderId, ..} ) <$> f orderOrderId+{-# INLINE orderOrderIdL #-}++-- | 'orderClOrdId' Lens+orderClOrdIdL :: Lens_' Order (Maybe Text)+orderClOrdIdL f Order{..} = (\orderClOrdId -> Order { orderClOrdId, ..} ) <$> f orderClOrdId+{-# INLINE orderClOrdIdL #-}++-- | 'orderClOrdLinkId' Lens+orderClOrdLinkIdL :: Lens_' Order (Maybe Text)+orderClOrdLinkIdL f Order{..} = (\orderClOrdLinkId -> Order { orderClOrdLinkId, ..} ) <$> f orderClOrdLinkId+{-# INLINE orderClOrdLinkIdL #-}++-- | 'orderAccount' Lens+orderAccountL :: Lens_' Order (Maybe Double)+orderAccountL f Order{..} = (\orderAccount -> Order { orderAccount, ..} ) <$> f orderAccount+{-# INLINE orderAccountL #-}++-- | 'orderSymbol' Lens+orderSymbolL :: Lens_' Order (Maybe Text)+orderSymbolL f Order{..} = (\orderSymbol -> Order { orderSymbol, ..} ) <$> f orderSymbol+{-# INLINE orderSymbolL #-}++-- | 'orderSide' Lens+orderSideL :: Lens_' Order (Maybe Text)+orderSideL f Order{..} = (\orderSide -> Order { orderSide, ..} ) <$> f orderSide+{-# INLINE orderSideL #-}++-- | 'orderSimpleOrderQty' Lens+orderSimpleOrderQtyL :: Lens_' Order (Maybe Double)+orderSimpleOrderQtyL f Order{..} = (\orderSimpleOrderQty -> Order { orderSimpleOrderQty, ..} ) <$> f orderSimpleOrderQty+{-# INLINE orderSimpleOrderQtyL #-}++-- | 'orderOrderQty' Lens+orderOrderQtyL :: Lens_' Order (Maybe Double)+orderOrderQtyL f Order{..} = (\orderOrderQty -> Order { orderOrderQty, ..} ) <$> f orderOrderQty+{-# INLINE orderOrderQtyL #-}++-- | 'orderPrice' Lens+orderPriceL :: Lens_' Order (Maybe Double)+orderPriceL f Order{..} = (\orderPrice -> Order { orderPrice, ..} ) <$> f orderPrice+{-# INLINE orderPriceL #-}++-- | 'orderDisplayQty' Lens+orderDisplayQtyL :: Lens_' Order (Maybe Double)+orderDisplayQtyL f Order{..} = (\orderDisplayQty -> Order { orderDisplayQty, ..} ) <$> f orderDisplayQty+{-# INLINE orderDisplayQtyL #-}++-- | 'orderStopPx' Lens+orderStopPxL :: Lens_' Order (Maybe Double)+orderStopPxL f Order{..} = (\orderStopPx -> Order { orderStopPx, ..} ) <$> f orderStopPx+{-# INLINE orderStopPxL #-}++-- | 'orderPegOffsetValue' Lens+orderPegOffsetValueL :: Lens_' Order (Maybe Double)+orderPegOffsetValueL f Order{..} = (\orderPegOffsetValue -> Order { orderPegOffsetValue, ..} ) <$> f orderPegOffsetValue+{-# INLINE orderPegOffsetValueL #-}++-- | 'orderPegPriceType' Lens+orderPegPriceTypeL :: Lens_' Order (Maybe Text)+orderPegPriceTypeL f Order{..} = (\orderPegPriceType -> Order { orderPegPriceType, ..} ) <$> f orderPegPriceType+{-# INLINE orderPegPriceTypeL #-}++-- | 'orderCurrency' Lens+orderCurrencyL :: Lens_' Order (Maybe Text)+orderCurrencyL f Order{..} = (\orderCurrency -> Order { orderCurrency, ..} ) <$> f orderCurrency+{-# INLINE orderCurrencyL #-}++-- | 'orderSettlCurrency' Lens+orderSettlCurrencyL :: Lens_' Order (Maybe Text)+orderSettlCurrencyL f Order{..} = (\orderSettlCurrency -> Order { orderSettlCurrency, ..} ) <$> f orderSettlCurrency+{-# INLINE orderSettlCurrencyL #-}++-- | 'orderOrdType' Lens+orderOrdTypeL :: Lens_' Order (Maybe Text)+orderOrdTypeL f Order{..} = (\orderOrdType -> Order { orderOrdType, ..} ) <$> f orderOrdType+{-# INLINE orderOrdTypeL #-}++-- | 'orderTimeInForce' Lens+orderTimeInForceL :: Lens_' Order (Maybe Text)+orderTimeInForceL f Order{..} = (\orderTimeInForce -> Order { orderTimeInForce, ..} ) <$> f orderTimeInForce+{-# INLINE orderTimeInForceL #-}++-- | 'orderExecInst' Lens+orderExecInstL :: Lens_' Order (Maybe Text)+orderExecInstL f Order{..} = (\orderExecInst -> Order { orderExecInst, ..} ) <$> f orderExecInst+{-# INLINE orderExecInstL #-}++-- | 'orderContingencyType' Lens+orderContingencyTypeL :: Lens_' Order (Maybe Text)+orderContingencyTypeL f Order{..} = (\orderContingencyType -> Order { orderContingencyType, ..} ) <$> f orderContingencyType+{-# INLINE orderContingencyTypeL #-}++-- | 'orderExDestination' Lens+orderExDestinationL :: Lens_' Order (Maybe Text)+orderExDestinationL f Order{..} = (\orderExDestination -> Order { orderExDestination, ..} ) <$> f orderExDestination+{-# INLINE orderExDestinationL #-}++-- | 'orderOrdStatus' Lens+orderOrdStatusL :: Lens_' Order (Maybe Text)+orderOrdStatusL f Order{..} = (\orderOrdStatus -> Order { orderOrdStatus, ..} ) <$> f orderOrdStatus+{-# INLINE orderOrdStatusL #-}++-- | 'orderTriggered' Lens+orderTriggeredL :: Lens_' Order (Maybe Text)+orderTriggeredL f Order{..} = (\orderTriggered -> Order { orderTriggered, ..} ) <$> f orderTriggered+{-# INLINE orderTriggeredL #-}++-- | 'orderWorkingIndicator' Lens+orderWorkingIndicatorL :: Lens_' Order (Maybe Bool)+orderWorkingIndicatorL f Order{..} = (\orderWorkingIndicator -> Order { orderWorkingIndicator, ..} ) <$> f orderWorkingIndicator+{-# INLINE orderWorkingIndicatorL #-}++-- | 'orderOrdRejReason' Lens+orderOrdRejReasonL :: Lens_' Order (Maybe Text)+orderOrdRejReasonL f Order{..} = (\orderOrdRejReason -> Order { orderOrdRejReason, ..} ) <$> f orderOrdRejReason+{-# INLINE orderOrdRejReasonL #-}++-- | 'orderSimpleLeavesQty' Lens+orderSimpleLeavesQtyL :: Lens_' Order (Maybe Double)+orderSimpleLeavesQtyL f Order{..} = (\orderSimpleLeavesQty -> Order { orderSimpleLeavesQty, ..} ) <$> f orderSimpleLeavesQty+{-# INLINE orderSimpleLeavesQtyL #-}++-- | 'orderLeavesQty' Lens+orderLeavesQtyL :: Lens_' Order (Maybe Double)+orderLeavesQtyL f Order{..} = (\orderLeavesQty -> Order { orderLeavesQty, ..} ) <$> f orderLeavesQty+{-# INLINE orderLeavesQtyL #-}++-- | 'orderSimpleCumQty' Lens+orderSimpleCumQtyL :: Lens_' Order (Maybe Double)+orderSimpleCumQtyL f Order{..} = (\orderSimpleCumQty -> Order { orderSimpleCumQty, ..} ) <$> f orderSimpleCumQty+{-# INLINE orderSimpleCumQtyL #-}++-- | 'orderCumQty' Lens+orderCumQtyL :: Lens_' Order (Maybe Double)+orderCumQtyL f Order{..} = (\orderCumQty -> Order { orderCumQty, ..} ) <$> f orderCumQty+{-# INLINE orderCumQtyL #-}++-- | 'orderAvgPx' Lens+orderAvgPxL :: Lens_' Order (Maybe Double)+orderAvgPxL f Order{..} = (\orderAvgPx -> Order { orderAvgPx, ..} ) <$> f orderAvgPx+{-# INLINE orderAvgPxL #-}++-- | 'orderMultiLegReportingType' Lens+orderMultiLegReportingTypeL :: Lens_' Order (Maybe Text)+orderMultiLegReportingTypeL f Order{..} = (\orderMultiLegReportingType -> Order { orderMultiLegReportingType, ..} ) <$> f orderMultiLegReportingType+{-# INLINE orderMultiLegReportingTypeL #-}++-- | 'orderText' Lens+orderTextL :: Lens_' Order (Maybe Text)+orderTextL f Order{..} = (\orderText -> Order { orderText, ..} ) <$> f orderText+{-# INLINE orderTextL #-}++-- | 'orderTransactTime' Lens+orderTransactTimeL :: Lens_' Order (Maybe DateTime)+orderTransactTimeL f Order{..} = (\orderTransactTime -> Order { orderTransactTime, ..} ) <$> f orderTransactTime+{-# INLINE orderTransactTimeL #-}++-- | 'orderTimestamp' Lens+orderTimestampL :: Lens_' Order (Maybe DateTime)+orderTimestampL f Order{..} = (\orderTimestamp -> Order { orderTimestamp, ..} ) <$> f orderTimestamp+{-# INLINE orderTimestampL #-}++++-- * OrderBook++-- | 'orderBookSymbol' Lens+orderBookSymbolL :: Lens_' OrderBook (Text)+orderBookSymbolL f OrderBook{..} = (\orderBookSymbol -> OrderBook { orderBookSymbol, ..} ) <$> f orderBookSymbol+{-# INLINE orderBookSymbolL #-}++-- | 'orderBookLevel' Lens+orderBookLevelL :: Lens_' OrderBook (Double)+orderBookLevelL f OrderBook{..} = (\orderBookLevel -> OrderBook { orderBookLevel, ..} ) <$> f orderBookLevel+{-# INLINE orderBookLevelL #-}++-- | 'orderBookBidSize' Lens+orderBookBidSizeL :: Lens_' OrderBook (Maybe Double)+orderBookBidSizeL f OrderBook{..} = (\orderBookBidSize -> OrderBook { orderBookBidSize, ..} ) <$> f orderBookBidSize+{-# INLINE orderBookBidSizeL #-}++-- | 'orderBookBidPrice' Lens+orderBookBidPriceL :: Lens_' OrderBook (Maybe Double)+orderBookBidPriceL f OrderBook{..} = (\orderBookBidPrice -> OrderBook { orderBookBidPrice, ..} ) <$> f orderBookBidPrice+{-# INLINE orderBookBidPriceL #-}++-- | 'orderBookAskPrice' Lens+orderBookAskPriceL :: Lens_' OrderBook (Maybe Double)+orderBookAskPriceL f OrderBook{..} = (\orderBookAskPrice -> OrderBook { orderBookAskPrice, ..} ) <$> f orderBookAskPrice+{-# INLINE orderBookAskPriceL #-}++-- | 'orderBookAskSize' Lens+orderBookAskSizeL :: Lens_' OrderBook (Maybe Double)+orderBookAskSizeL f OrderBook{..} = (\orderBookAskSize -> OrderBook { orderBookAskSize, ..} ) <$> f orderBookAskSize+{-# INLINE orderBookAskSizeL #-}++-- | 'orderBookTimestamp' Lens+orderBookTimestampL :: Lens_' OrderBook (Maybe DateTime)+orderBookTimestampL f OrderBook{..} = (\orderBookTimestamp -> OrderBook { orderBookTimestamp, ..} ) <$> f orderBookTimestamp+{-# INLINE orderBookTimestampL #-}++++-- * OrderBookL2++-- | 'orderBookL2Symbol' Lens+orderBookL2SymbolL :: Lens_' OrderBookL2 (Text)+orderBookL2SymbolL f OrderBookL2{..} = (\orderBookL2Symbol -> OrderBookL2 { orderBookL2Symbol, ..} ) <$> f orderBookL2Symbol+{-# INLINE orderBookL2SymbolL #-}++-- | 'orderBookL2Id' Lens+orderBookL2IdL :: Lens_' OrderBookL2 (Double)+orderBookL2IdL f OrderBookL2{..} = (\orderBookL2Id -> OrderBookL2 { orderBookL2Id, ..} ) <$> f orderBookL2Id+{-# INLINE orderBookL2IdL #-}++-- | 'orderBookL2Side' Lens+orderBookL2SideL :: Lens_' OrderBookL2 (Text)+orderBookL2SideL f OrderBookL2{..} = (\orderBookL2Side -> OrderBookL2 { orderBookL2Side, ..} ) <$> f orderBookL2Side+{-# INLINE orderBookL2SideL #-}++-- | 'orderBookL2Size' Lens+orderBookL2SizeL :: Lens_' OrderBookL2 (Maybe Double)+orderBookL2SizeL f OrderBookL2{..} = (\orderBookL2Size -> OrderBookL2 { orderBookL2Size, ..} ) <$> f orderBookL2Size+{-# INLINE orderBookL2SizeL #-}++-- | 'orderBookL2Price' Lens+orderBookL2PriceL :: Lens_' OrderBookL2 (Maybe Double)+orderBookL2PriceL f OrderBookL2{..} = (\orderBookL2Price -> OrderBookL2 { orderBookL2Price, ..} ) <$> f orderBookL2Price+{-# INLINE orderBookL2PriceL #-}++++-- * Position++-- | 'positionAccount' Lens+positionAccountL :: Lens_' Position (Double)+positionAccountL f Position{..} = (\positionAccount -> Position { positionAccount, ..} ) <$> f positionAccount+{-# INLINE positionAccountL #-}++-- | 'positionSymbol' Lens+positionSymbolL :: Lens_' Position (Text)+positionSymbolL f Position{..} = (\positionSymbol -> Position { positionSymbol, ..} ) <$> f positionSymbol+{-# INLINE positionSymbolL #-}++-- | 'positionCurrency' Lens+positionCurrencyL :: Lens_' Position (Text)+positionCurrencyL f Position{..} = (\positionCurrency -> Position { positionCurrency, ..} ) <$> f positionCurrency+{-# INLINE positionCurrencyL #-}++-- | 'positionUnderlying' Lens+positionUnderlyingL :: Lens_' Position (Maybe Text)+positionUnderlyingL f Position{..} = (\positionUnderlying -> Position { positionUnderlying, ..} ) <$> f positionUnderlying+{-# INLINE positionUnderlyingL #-}++-- | 'positionQuoteCurrency' Lens+positionQuoteCurrencyL :: Lens_' Position (Maybe Text)+positionQuoteCurrencyL f Position{..} = (\positionQuoteCurrency -> Position { positionQuoteCurrency, ..} ) <$> f positionQuoteCurrency+{-# INLINE positionQuoteCurrencyL #-}++-- | 'positionCommission' Lens+positionCommissionL :: Lens_' Position (Maybe Double)+positionCommissionL f Position{..} = (\positionCommission -> Position { positionCommission, ..} ) <$> f positionCommission+{-# INLINE positionCommissionL #-}++-- | 'positionInitMarginReq' Lens+positionInitMarginReqL :: Lens_' Position (Maybe Double)+positionInitMarginReqL f Position{..} = (\positionInitMarginReq -> Position { positionInitMarginReq, ..} ) <$> f positionInitMarginReq+{-# INLINE positionInitMarginReqL #-}++-- | 'positionMaintMarginReq' Lens+positionMaintMarginReqL :: Lens_' Position (Maybe Double)+positionMaintMarginReqL f Position{..} = (\positionMaintMarginReq -> Position { positionMaintMarginReq, ..} ) <$> f positionMaintMarginReq+{-# INLINE positionMaintMarginReqL #-}++-- | 'positionRiskLimit' Lens+positionRiskLimitL :: Lens_' Position (Maybe Double)+positionRiskLimitL f Position{..} = (\positionRiskLimit -> Position { positionRiskLimit, ..} ) <$> f positionRiskLimit+{-# INLINE positionRiskLimitL #-}++-- | 'positionLeverage' Lens+positionLeverageL :: Lens_' Position (Maybe Double)+positionLeverageL f Position{..} = (\positionLeverage -> Position { positionLeverage, ..} ) <$> f positionLeverage+{-# INLINE positionLeverageL #-}++-- | 'positionCrossMargin' Lens+positionCrossMarginL :: Lens_' Position (Maybe Bool)+positionCrossMarginL f Position{..} = (\positionCrossMargin -> Position { positionCrossMargin, ..} ) <$> f positionCrossMargin+{-# INLINE positionCrossMarginL #-}++-- | 'positionDeleveragePercentile' Lens+positionDeleveragePercentileL :: Lens_' Position (Maybe Double)+positionDeleveragePercentileL f Position{..} = (\positionDeleveragePercentile -> Position { positionDeleveragePercentile, ..} ) <$> f positionDeleveragePercentile+{-# INLINE positionDeleveragePercentileL #-}++-- | 'positionRebalancedPnl' Lens+positionRebalancedPnlL :: Lens_' Position (Maybe Double)+positionRebalancedPnlL f Position{..} = (\positionRebalancedPnl -> Position { positionRebalancedPnl, ..} ) <$> f positionRebalancedPnl+{-# INLINE positionRebalancedPnlL #-}++-- | 'positionPrevRealisedPnl' Lens+positionPrevRealisedPnlL :: Lens_' Position (Maybe Double)+positionPrevRealisedPnlL f Position{..} = (\positionPrevRealisedPnl -> Position { positionPrevRealisedPnl, ..} ) <$> f positionPrevRealisedPnl+{-# INLINE positionPrevRealisedPnlL #-}++-- | 'positionPrevUnrealisedPnl' Lens+positionPrevUnrealisedPnlL :: Lens_' Position (Maybe Double)+positionPrevUnrealisedPnlL f Position{..} = (\positionPrevUnrealisedPnl -> Position { positionPrevUnrealisedPnl, ..} ) <$> f positionPrevUnrealisedPnl+{-# INLINE positionPrevUnrealisedPnlL #-}++-- | 'positionPrevClosePrice' Lens+positionPrevClosePriceL :: Lens_' Position (Maybe Double)+positionPrevClosePriceL f Position{..} = (\positionPrevClosePrice -> Position { positionPrevClosePrice, ..} ) <$> f positionPrevClosePrice+{-# INLINE positionPrevClosePriceL #-}++-- | 'positionOpeningTimestamp' Lens+positionOpeningTimestampL :: Lens_' Position (Maybe DateTime)+positionOpeningTimestampL f Position{..} = (\positionOpeningTimestamp -> Position { positionOpeningTimestamp, ..} ) <$> f positionOpeningTimestamp+{-# INLINE positionOpeningTimestampL #-}++-- | 'positionOpeningQty' Lens+positionOpeningQtyL :: Lens_' Position (Maybe Double)+positionOpeningQtyL f Position{..} = (\positionOpeningQty -> Position { positionOpeningQty, ..} ) <$> f positionOpeningQty+{-# INLINE positionOpeningQtyL #-}++-- | 'positionOpeningCost' Lens+positionOpeningCostL :: Lens_' Position (Maybe Double)+positionOpeningCostL f Position{..} = (\positionOpeningCost -> Position { positionOpeningCost, ..} ) <$> f positionOpeningCost+{-# INLINE positionOpeningCostL #-}++-- | 'positionOpeningComm' Lens+positionOpeningCommL :: Lens_' Position (Maybe Double)+positionOpeningCommL f Position{..} = (\positionOpeningComm -> Position { positionOpeningComm, ..} ) <$> f positionOpeningComm+{-# INLINE positionOpeningCommL #-}++-- | 'positionOpenOrderBuyQty' Lens+positionOpenOrderBuyQtyL :: Lens_' Position (Maybe Double)+positionOpenOrderBuyQtyL f Position{..} = (\positionOpenOrderBuyQty -> Position { positionOpenOrderBuyQty, ..} ) <$> f positionOpenOrderBuyQty+{-# INLINE positionOpenOrderBuyQtyL #-}++-- | 'positionOpenOrderBuyCost' Lens+positionOpenOrderBuyCostL :: Lens_' Position (Maybe Double)+positionOpenOrderBuyCostL f Position{..} = (\positionOpenOrderBuyCost -> Position { positionOpenOrderBuyCost, ..} ) <$> f positionOpenOrderBuyCost+{-# INLINE positionOpenOrderBuyCostL #-}++-- | 'positionOpenOrderBuyPremium' Lens+positionOpenOrderBuyPremiumL :: Lens_' Position (Maybe Double)+positionOpenOrderBuyPremiumL f Position{..} = (\positionOpenOrderBuyPremium -> Position { positionOpenOrderBuyPremium, ..} ) <$> f positionOpenOrderBuyPremium+{-# INLINE positionOpenOrderBuyPremiumL #-}++-- | 'positionOpenOrderSellQty' Lens+positionOpenOrderSellQtyL :: Lens_' Position (Maybe Double)+positionOpenOrderSellQtyL f Position{..} = (\positionOpenOrderSellQty -> Position { positionOpenOrderSellQty, ..} ) <$> f positionOpenOrderSellQty+{-# INLINE positionOpenOrderSellQtyL #-}++-- | 'positionOpenOrderSellCost' Lens+positionOpenOrderSellCostL :: Lens_' Position (Maybe Double)+positionOpenOrderSellCostL f Position{..} = (\positionOpenOrderSellCost -> Position { positionOpenOrderSellCost, ..} ) <$> f positionOpenOrderSellCost+{-# INLINE positionOpenOrderSellCostL #-}++-- | 'positionOpenOrderSellPremium' Lens+positionOpenOrderSellPremiumL :: Lens_' Position (Maybe Double)+positionOpenOrderSellPremiumL f Position{..} = (\positionOpenOrderSellPremium -> Position { positionOpenOrderSellPremium, ..} ) <$> f positionOpenOrderSellPremium+{-# INLINE positionOpenOrderSellPremiumL #-}++-- | 'positionExecBuyQty' Lens+positionExecBuyQtyL :: Lens_' Position (Maybe Double)+positionExecBuyQtyL f Position{..} = (\positionExecBuyQty -> Position { positionExecBuyQty, ..} ) <$> f positionExecBuyQty+{-# INLINE positionExecBuyQtyL #-}++-- | 'positionExecBuyCost' Lens+positionExecBuyCostL :: Lens_' Position (Maybe Double)+positionExecBuyCostL f Position{..} = (\positionExecBuyCost -> Position { positionExecBuyCost, ..} ) <$> f positionExecBuyCost+{-# INLINE positionExecBuyCostL #-}++-- | 'positionExecSellQty' Lens+positionExecSellQtyL :: Lens_' Position (Maybe Double)+positionExecSellQtyL f Position{..} = (\positionExecSellQty -> Position { positionExecSellQty, ..} ) <$> f positionExecSellQty+{-# INLINE positionExecSellQtyL #-}++-- | 'positionExecSellCost' Lens+positionExecSellCostL :: Lens_' Position (Maybe Double)+positionExecSellCostL f Position{..} = (\positionExecSellCost -> Position { positionExecSellCost, ..} ) <$> f positionExecSellCost+{-# INLINE positionExecSellCostL #-}++-- | 'positionExecQty' Lens+positionExecQtyL :: Lens_' Position (Maybe Double)+positionExecQtyL f Position{..} = (\positionExecQty -> Position { positionExecQty, ..} ) <$> f positionExecQty+{-# INLINE positionExecQtyL #-}++-- | 'positionExecCost' Lens+positionExecCostL :: Lens_' Position (Maybe Double)+positionExecCostL f Position{..} = (\positionExecCost -> Position { positionExecCost, ..} ) <$> f positionExecCost+{-# INLINE positionExecCostL #-}++-- | 'positionExecComm' Lens+positionExecCommL :: Lens_' Position (Maybe Double)+positionExecCommL f Position{..} = (\positionExecComm -> Position { positionExecComm, ..} ) <$> f positionExecComm+{-# INLINE positionExecCommL #-}++-- | 'positionCurrentTimestamp' Lens+positionCurrentTimestampL :: Lens_' Position (Maybe DateTime)+positionCurrentTimestampL f Position{..} = (\positionCurrentTimestamp -> Position { positionCurrentTimestamp, ..} ) <$> f positionCurrentTimestamp+{-# INLINE positionCurrentTimestampL #-}++-- | 'positionCurrentQty' Lens+positionCurrentQtyL :: Lens_' Position (Maybe Double)+positionCurrentQtyL f Position{..} = (\positionCurrentQty -> Position { positionCurrentQty, ..} ) <$> f positionCurrentQty+{-# INLINE positionCurrentQtyL #-}++-- | 'positionCurrentCost' Lens+positionCurrentCostL :: Lens_' Position (Maybe Double)+positionCurrentCostL f Position{..} = (\positionCurrentCost -> Position { positionCurrentCost, ..} ) <$> f positionCurrentCost+{-# INLINE positionCurrentCostL #-}++-- | 'positionCurrentComm' Lens+positionCurrentCommL :: Lens_' Position (Maybe Double)+positionCurrentCommL f Position{..} = (\positionCurrentComm -> Position { positionCurrentComm, ..} ) <$> f positionCurrentComm+{-# INLINE positionCurrentCommL #-}++-- | 'positionRealisedCost' Lens+positionRealisedCostL :: Lens_' Position (Maybe Double)+positionRealisedCostL f Position{..} = (\positionRealisedCost -> Position { positionRealisedCost, ..} ) <$> f positionRealisedCost+{-# INLINE positionRealisedCostL #-}++-- | 'positionUnrealisedCost' Lens+positionUnrealisedCostL :: Lens_' Position (Maybe Double)+positionUnrealisedCostL f Position{..} = (\positionUnrealisedCost -> Position { positionUnrealisedCost, ..} ) <$> f positionUnrealisedCost+{-# INLINE positionUnrealisedCostL #-}++-- | 'positionGrossOpenCost' Lens+positionGrossOpenCostL :: Lens_' Position (Maybe Double)+positionGrossOpenCostL f Position{..} = (\positionGrossOpenCost -> Position { positionGrossOpenCost, ..} ) <$> f positionGrossOpenCost+{-# INLINE positionGrossOpenCostL #-}++-- | 'positionGrossOpenPremium' Lens+positionGrossOpenPremiumL :: Lens_' Position (Maybe Double)+positionGrossOpenPremiumL f Position{..} = (\positionGrossOpenPremium -> Position { positionGrossOpenPremium, ..} ) <$> f positionGrossOpenPremium+{-# INLINE positionGrossOpenPremiumL #-}++-- | 'positionGrossExecCost' Lens+positionGrossExecCostL :: Lens_' Position (Maybe Double)+positionGrossExecCostL f Position{..} = (\positionGrossExecCost -> Position { positionGrossExecCost, ..} ) <$> f positionGrossExecCost+{-# INLINE positionGrossExecCostL #-}++-- | 'positionIsOpen' Lens+positionIsOpenL :: Lens_' Position (Maybe Bool)+positionIsOpenL f Position{..} = (\positionIsOpen -> Position { positionIsOpen, ..} ) <$> f positionIsOpen+{-# INLINE positionIsOpenL #-}++-- | 'positionMarkPrice' Lens+positionMarkPriceL :: Lens_' Position (Maybe Double)+positionMarkPriceL f Position{..} = (\positionMarkPrice -> Position { positionMarkPrice, ..} ) <$> f positionMarkPrice+{-# INLINE positionMarkPriceL #-}++-- | 'positionMarkValue' Lens+positionMarkValueL :: Lens_' Position (Maybe Double)+positionMarkValueL f Position{..} = (\positionMarkValue -> Position { positionMarkValue, ..} ) <$> f positionMarkValue+{-# INLINE positionMarkValueL #-}++-- | 'positionRiskValue' Lens+positionRiskValueL :: Lens_' Position (Maybe Double)+positionRiskValueL f Position{..} = (\positionRiskValue -> Position { positionRiskValue, ..} ) <$> f positionRiskValue+{-# INLINE positionRiskValueL #-}++-- | 'positionHomeNotional' Lens+positionHomeNotionalL :: Lens_' Position (Maybe Double)+positionHomeNotionalL f Position{..} = (\positionHomeNotional -> Position { positionHomeNotional, ..} ) <$> f positionHomeNotional+{-# INLINE positionHomeNotionalL #-}++-- | 'positionForeignNotional' Lens+positionForeignNotionalL :: Lens_' Position (Maybe Double)+positionForeignNotionalL f Position{..} = (\positionForeignNotional -> Position { positionForeignNotional, ..} ) <$> f positionForeignNotional+{-# INLINE positionForeignNotionalL #-}++-- | 'positionPosState' Lens+positionPosStateL :: Lens_' Position (Maybe Text)+positionPosStateL f Position{..} = (\positionPosState -> Position { positionPosState, ..} ) <$> f positionPosState+{-# INLINE positionPosStateL #-}++-- | 'positionPosCost' Lens+positionPosCostL :: Lens_' Position (Maybe Double)+positionPosCostL f Position{..} = (\positionPosCost -> Position { positionPosCost, ..} ) <$> f positionPosCost+{-# INLINE positionPosCostL #-}++-- | 'positionPosCost2' Lens+positionPosCost2L :: Lens_' Position (Maybe Double)+positionPosCost2L f Position{..} = (\positionPosCost2 -> Position { positionPosCost2, ..} ) <$> f positionPosCost2+{-# INLINE positionPosCost2L #-}++-- | 'positionPosCross' Lens+positionPosCrossL :: Lens_' Position (Maybe Double)+positionPosCrossL f Position{..} = (\positionPosCross -> Position { positionPosCross, ..} ) <$> f positionPosCross+{-# INLINE positionPosCrossL #-}++-- | 'positionPosInit' Lens+positionPosInitL :: Lens_' Position (Maybe Double)+positionPosInitL f Position{..} = (\positionPosInit -> Position { positionPosInit, ..} ) <$> f positionPosInit+{-# INLINE positionPosInitL #-}++-- | 'positionPosComm' Lens+positionPosCommL :: Lens_' Position (Maybe Double)+positionPosCommL f Position{..} = (\positionPosComm -> Position { positionPosComm, ..} ) <$> f positionPosComm+{-# INLINE positionPosCommL #-}++-- | 'positionPosLoss' Lens+positionPosLossL :: Lens_' Position (Maybe Double)+positionPosLossL f Position{..} = (\positionPosLoss -> Position { positionPosLoss, ..} ) <$> f positionPosLoss+{-# INLINE positionPosLossL #-}++-- | 'positionPosMargin' Lens+positionPosMarginL :: Lens_' Position (Maybe Double)+positionPosMarginL f Position{..} = (\positionPosMargin -> Position { positionPosMargin, ..} ) <$> f positionPosMargin+{-# INLINE positionPosMarginL #-}++-- | 'positionPosMaint' Lens+positionPosMaintL :: Lens_' Position (Maybe Double)+positionPosMaintL f Position{..} = (\positionPosMaint -> Position { positionPosMaint, ..} ) <$> f positionPosMaint+{-# INLINE positionPosMaintL #-}++-- | 'positionPosAllowance' Lens+positionPosAllowanceL :: Lens_' Position (Maybe Double)+positionPosAllowanceL f Position{..} = (\positionPosAllowance -> Position { positionPosAllowance, ..} ) <$> f positionPosAllowance+{-# INLINE positionPosAllowanceL #-}++-- | 'positionTaxableMargin' Lens+positionTaxableMarginL :: Lens_' Position (Maybe Double)+positionTaxableMarginL f Position{..} = (\positionTaxableMargin -> Position { positionTaxableMargin, ..} ) <$> f positionTaxableMargin+{-# INLINE positionTaxableMarginL #-}++-- | 'positionInitMargin' Lens+positionInitMarginL :: Lens_' Position (Maybe Double)+positionInitMarginL f Position{..} = (\positionInitMargin -> Position { positionInitMargin, ..} ) <$> f positionInitMargin+{-# INLINE positionInitMarginL #-}++-- | 'positionMaintMargin' Lens+positionMaintMarginL :: Lens_' Position (Maybe Double)+positionMaintMarginL f Position{..} = (\positionMaintMargin -> Position { positionMaintMargin, ..} ) <$> f positionMaintMargin+{-# INLINE positionMaintMarginL #-}++-- | 'positionSessionMargin' Lens+positionSessionMarginL :: Lens_' Position (Maybe Double)+positionSessionMarginL f Position{..} = (\positionSessionMargin -> Position { positionSessionMargin, ..} ) <$> f positionSessionMargin+{-# INLINE positionSessionMarginL #-}++-- | 'positionTargetExcessMargin' Lens+positionTargetExcessMarginL :: Lens_' Position (Maybe Double)+positionTargetExcessMarginL f Position{..} = (\positionTargetExcessMargin -> Position { positionTargetExcessMargin, ..} ) <$> f positionTargetExcessMargin+{-# INLINE positionTargetExcessMarginL #-}++-- | 'positionVarMargin' Lens+positionVarMarginL :: Lens_' Position (Maybe Double)+positionVarMarginL f Position{..} = (\positionVarMargin -> Position { positionVarMargin, ..} ) <$> f positionVarMargin+{-# INLINE positionVarMarginL #-}++-- | 'positionRealisedGrossPnl' Lens+positionRealisedGrossPnlL :: Lens_' Position (Maybe Double)+positionRealisedGrossPnlL f Position{..} = (\positionRealisedGrossPnl -> Position { positionRealisedGrossPnl, ..} ) <$> f positionRealisedGrossPnl+{-# INLINE positionRealisedGrossPnlL #-}++-- | 'positionRealisedTax' Lens+positionRealisedTaxL :: Lens_' Position (Maybe Double)+positionRealisedTaxL f Position{..} = (\positionRealisedTax -> Position { positionRealisedTax, ..} ) <$> f positionRealisedTax+{-# INLINE positionRealisedTaxL #-}++-- | 'positionRealisedPnl' Lens+positionRealisedPnlL :: Lens_' Position (Maybe Double)+positionRealisedPnlL f Position{..} = (\positionRealisedPnl -> Position { positionRealisedPnl, ..} ) <$> f positionRealisedPnl+{-# INLINE positionRealisedPnlL #-}++-- | 'positionUnrealisedGrossPnl' Lens+positionUnrealisedGrossPnlL :: Lens_' Position (Maybe Double)+positionUnrealisedGrossPnlL f Position{..} = (\positionUnrealisedGrossPnl -> Position { positionUnrealisedGrossPnl, ..} ) <$> f positionUnrealisedGrossPnl+{-# INLINE positionUnrealisedGrossPnlL #-}++-- | 'positionLongBankrupt' Lens+positionLongBankruptL :: Lens_' Position (Maybe Double)+positionLongBankruptL f Position{..} = (\positionLongBankrupt -> Position { positionLongBankrupt, ..} ) <$> f positionLongBankrupt+{-# INLINE positionLongBankruptL #-}++-- | 'positionShortBankrupt' Lens+positionShortBankruptL :: Lens_' Position (Maybe Double)+positionShortBankruptL f Position{..} = (\positionShortBankrupt -> Position { positionShortBankrupt, ..} ) <$> f positionShortBankrupt+{-# INLINE positionShortBankruptL #-}++-- | 'positionTaxBase' Lens+positionTaxBaseL :: Lens_' Position (Maybe Double)+positionTaxBaseL f Position{..} = (\positionTaxBase -> Position { positionTaxBase, ..} ) <$> f positionTaxBase+{-# INLINE positionTaxBaseL #-}++-- | 'positionIndicativeTaxRate' Lens+positionIndicativeTaxRateL :: Lens_' Position (Maybe Double)+positionIndicativeTaxRateL f Position{..} = (\positionIndicativeTaxRate -> Position { positionIndicativeTaxRate, ..} ) <$> f positionIndicativeTaxRate+{-# INLINE positionIndicativeTaxRateL #-}++-- | 'positionIndicativeTax' Lens+positionIndicativeTaxL :: Lens_' Position (Maybe Double)+positionIndicativeTaxL f Position{..} = (\positionIndicativeTax -> Position { positionIndicativeTax, ..} ) <$> f positionIndicativeTax+{-# INLINE positionIndicativeTaxL #-}++-- | 'positionUnrealisedTax' Lens+positionUnrealisedTaxL :: Lens_' Position (Maybe Double)+positionUnrealisedTaxL f Position{..} = (\positionUnrealisedTax -> Position { positionUnrealisedTax, ..} ) <$> f positionUnrealisedTax+{-# INLINE positionUnrealisedTaxL #-}++-- | 'positionUnrealisedPnl' Lens+positionUnrealisedPnlL :: Lens_' Position (Maybe Double)+positionUnrealisedPnlL f Position{..} = (\positionUnrealisedPnl -> Position { positionUnrealisedPnl, ..} ) <$> f positionUnrealisedPnl+{-# INLINE positionUnrealisedPnlL #-}++-- | 'positionUnrealisedPnlPcnt' Lens+positionUnrealisedPnlPcntL :: Lens_' Position (Maybe Double)+positionUnrealisedPnlPcntL f Position{..} = (\positionUnrealisedPnlPcnt -> Position { positionUnrealisedPnlPcnt, ..} ) <$> f positionUnrealisedPnlPcnt+{-# INLINE positionUnrealisedPnlPcntL #-}++-- | 'positionUnrealisedRoePcnt' Lens+positionUnrealisedRoePcntL :: Lens_' Position (Maybe Double)+positionUnrealisedRoePcntL f Position{..} = (\positionUnrealisedRoePcnt -> Position { positionUnrealisedRoePcnt, ..} ) <$> f positionUnrealisedRoePcnt+{-# INLINE positionUnrealisedRoePcntL #-}++-- | 'positionSimpleQty' Lens+positionSimpleQtyL :: Lens_' Position (Maybe Double)+positionSimpleQtyL f Position{..} = (\positionSimpleQty -> Position { positionSimpleQty, ..} ) <$> f positionSimpleQty+{-# INLINE positionSimpleQtyL #-}++-- | 'positionSimpleCost' Lens+positionSimpleCostL :: Lens_' Position (Maybe Double)+positionSimpleCostL f Position{..} = (\positionSimpleCost -> Position { positionSimpleCost, ..} ) <$> f positionSimpleCost+{-# INLINE positionSimpleCostL #-}++-- | 'positionSimpleValue' Lens+positionSimpleValueL :: Lens_' Position (Maybe Double)+positionSimpleValueL f Position{..} = (\positionSimpleValue -> Position { positionSimpleValue, ..} ) <$> f positionSimpleValue+{-# INLINE positionSimpleValueL #-}++-- | 'positionSimplePnl' Lens+positionSimplePnlL :: Lens_' Position (Maybe Double)+positionSimplePnlL f Position{..} = (\positionSimplePnl -> Position { positionSimplePnl, ..} ) <$> f positionSimplePnl+{-# INLINE positionSimplePnlL #-}++-- | 'positionSimplePnlPcnt' Lens+positionSimplePnlPcntL :: Lens_' Position (Maybe Double)+positionSimplePnlPcntL f Position{..} = (\positionSimplePnlPcnt -> Position { positionSimplePnlPcnt, ..} ) <$> f positionSimplePnlPcnt+{-# INLINE positionSimplePnlPcntL #-}++-- | 'positionAvgCostPrice' Lens+positionAvgCostPriceL :: Lens_' Position (Maybe Double)+positionAvgCostPriceL f Position{..} = (\positionAvgCostPrice -> Position { positionAvgCostPrice, ..} ) <$> f positionAvgCostPrice+{-# INLINE positionAvgCostPriceL #-}++-- | 'positionAvgEntryPrice' Lens+positionAvgEntryPriceL :: Lens_' Position (Maybe Double)+positionAvgEntryPriceL f Position{..} = (\positionAvgEntryPrice -> Position { positionAvgEntryPrice, ..} ) <$> f positionAvgEntryPrice+{-# INLINE positionAvgEntryPriceL #-}++-- | 'positionBreakEvenPrice' Lens+positionBreakEvenPriceL :: Lens_' Position (Maybe Double)+positionBreakEvenPriceL f Position{..} = (\positionBreakEvenPrice -> Position { positionBreakEvenPrice, ..} ) <$> f positionBreakEvenPrice+{-# INLINE positionBreakEvenPriceL #-}++-- | 'positionMarginCallPrice' Lens+positionMarginCallPriceL :: Lens_' Position (Maybe Double)+positionMarginCallPriceL f Position{..} = (\positionMarginCallPrice -> Position { positionMarginCallPrice, ..} ) <$> f positionMarginCallPrice+{-# INLINE positionMarginCallPriceL #-}++-- | 'positionLiquidationPrice' Lens+positionLiquidationPriceL :: Lens_' Position (Maybe Double)+positionLiquidationPriceL f Position{..} = (\positionLiquidationPrice -> Position { positionLiquidationPrice, ..} ) <$> f positionLiquidationPrice+{-# INLINE positionLiquidationPriceL #-}++-- | 'positionBankruptPrice' Lens+positionBankruptPriceL :: Lens_' Position (Maybe Double)+positionBankruptPriceL f Position{..} = (\positionBankruptPrice -> Position { positionBankruptPrice, ..} ) <$> f positionBankruptPrice+{-# INLINE positionBankruptPriceL #-}++-- | 'positionTimestamp' Lens+positionTimestampL :: Lens_' Position (Maybe DateTime)+positionTimestampL f Position{..} = (\positionTimestamp -> Position { positionTimestamp, ..} ) <$> f positionTimestamp+{-# INLINE positionTimestampL #-}++-- | 'positionLastPrice' Lens+positionLastPriceL :: Lens_' Position (Maybe Double)+positionLastPriceL f Position{..} = (\positionLastPrice -> Position { positionLastPrice, ..} ) <$> f positionLastPrice+{-# INLINE positionLastPriceL #-}++-- | 'positionLastValue' Lens+positionLastValueL :: Lens_' Position (Maybe Double)+positionLastValueL f Position{..} = (\positionLastValue -> Position { positionLastValue, ..} ) <$> f positionLastValue+{-# INLINE positionLastValueL #-}++++-- * Quote++-- | 'quoteTimestamp' Lens+quoteTimestampL :: Lens_' Quote (DateTime)+quoteTimestampL f Quote{..} = (\quoteTimestamp -> Quote { quoteTimestamp, ..} ) <$> f quoteTimestamp+{-# INLINE quoteTimestampL #-}++-- | 'quoteSymbol' Lens+quoteSymbolL :: Lens_' Quote (Text)+quoteSymbolL f Quote{..} = (\quoteSymbol -> Quote { quoteSymbol, ..} ) <$> f quoteSymbol+{-# INLINE quoteSymbolL #-}++-- | 'quoteBidSize' Lens+quoteBidSizeL :: Lens_' Quote (Maybe Double)+quoteBidSizeL f Quote{..} = (\quoteBidSize -> Quote { quoteBidSize, ..} ) <$> f quoteBidSize+{-# INLINE quoteBidSizeL #-}++-- | 'quoteBidPrice' Lens+quoteBidPriceL :: Lens_' Quote (Maybe Double)+quoteBidPriceL f Quote{..} = (\quoteBidPrice -> Quote { quoteBidPrice, ..} ) <$> f quoteBidPrice+{-# INLINE quoteBidPriceL #-}++-- | 'quoteAskPrice' Lens+quoteAskPriceL :: Lens_' Quote (Maybe Double)+quoteAskPriceL f Quote{..} = (\quoteAskPrice -> Quote { quoteAskPrice, ..} ) <$> f quoteAskPrice+{-# INLINE quoteAskPriceL #-}++-- | 'quoteAskSize' Lens+quoteAskSizeL :: Lens_' Quote (Maybe Double)+quoteAskSizeL f Quote{..} = (\quoteAskSize -> Quote { quoteAskSize, ..} ) <$> f quoteAskSize+{-# INLINE quoteAskSizeL #-}++++-- * Settlement++-- | 'settlementTimestamp' Lens+settlementTimestampL :: Lens_' Settlement (DateTime)+settlementTimestampL f Settlement{..} = (\settlementTimestamp -> Settlement { settlementTimestamp, ..} ) <$> f settlementTimestamp+{-# INLINE settlementTimestampL #-}++-- | 'settlementSymbol' Lens+settlementSymbolL :: Lens_' Settlement (Text)+settlementSymbolL f Settlement{..} = (\settlementSymbol -> Settlement { settlementSymbol, ..} ) <$> f settlementSymbol+{-# INLINE settlementSymbolL #-}++-- | 'settlementSettlementType' Lens+settlementSettlementTypeL :: Lens_' Settlement (Maybe Text)+settlementSettlementTypeL f Settlement{..} = (\settlementSettlementType -> Settlement { settlementSettlementType, ..} ) <$> f settlementSettlementType+{-# INLINE settlementSettlementTypeL #-}++-- | 'settlementSettledPrice' Lens+settlementSettledPriceL :: Lens_' Settlement (Maybe Double)+settlementSettledPriceL f Settlement{..} = (\settlementSettledPrice -> Settlement { settlementSettledPrice, ..} ) <$> f settlementSettledPrice+{-# INLINE settlementSettledPriceL #-}++-- | 'settlementBankrupt' Lens+settlementBankruptL :: Lens_' Settlement (Maybe Double)+settlementBankruptL f Settlement{..} = (\settlementBankrupt -> Settlement { settlementBankrupt, ..} ) <$> f settlementBankrupt+{-# INLINE settlementBankruptL #-}++-- | 'settlementTaxBase' Lens+settlementTaxBaseL :: Lens_' Settlement (Maybe Double)+settlementTaxBaseL f Settlement{..} = (\settlementTaxBase -> Settlement { settlementTaxBase, ..} ) <$> f settlementTaxBase+{-# INLINE settlementTaxBaseL #-}++-- | 'settlementTaxRate' Lens+settlementTaxRateL :: Lens_' Settlement (Maybe Double)+settlementTaxRateL f Settlement{..} = (\settlementTaxRate -> Settlement { settlementTaxRate, ..} ) <$> f settlementTaxRate+{-# INLINE settlementTaxRateL #-}++++-- * Stats++-- | 'statsRootSymbol' Lens+statsRootSymbolL :: Lens_' Stats (Text)+statsRootSymbolL f Stats{..} = (\statsRootSymbol -> Stats { statsRootSymbol, ..} ) <$> f statsRootSymbol+{-# INLINE statsRootSymbolL #-}++-- | 'statsCurrency' Lens+statsCurrencyL :: Lens_' Stats (Maybe Text)+statsCurrencyL f Stats{..} = (\statsCurrency -> Stats { statsCurrency, ..} ) <$> f statsCurrency+{-# INLINE statsCurrencyL #-}++-- | 'statsVolume24h' Lens+statsVolume24hL :: Lens_' Stats (Maybe Double)+statsVolume24hL f Stats{..} = (\statsVolume24h -> Stats { statsVolume24h, ..} ) <$> f statsVolume24h+{-# INLINE statsVolume24hL #-}++-- | 'statsTurnover24h' Lens+statsTurnover24hL :: Lens_' Stats (Maybe Double)+statsTurnover24hL f Stats{..} = (\statsTurnover24h -> Stats { statsTurnover24h, ..} ) <$> f statsTurnover24h+{-# INLINE statsTurnover24hL #-}++-- | 'statsOpenInterest' Lens+statsOpenInterestL :: Lens_' Stats (Maybe Double)+statsOpenInterestL f Stats{..} = (\statsOpenInterest -> Stats { statsOpenInterest, ..} ) <$> f statsOpenInterest+{-# INLINE statsOpenInterestL #-}++-- | 'statsOpenValue' Lens+statsOpenValueL :: Lens_' Stats (Maybe Double)+statsOpenValueL f Stats{..} = (\statsOpenValue -> Stats { statsOpenValue, ..} ) <$> f statsOpenValue+{-# INLINE statsOpenValueL #-}++++-- * StatsHistory++-- | 'statsHistoryDate' Lens+statsHistoryDateL :: Lens_' StatsHistory (DateTime)+statsHistoryDateL f StatsHistory{..} = (\statsHistoryDate -> StatsHistory { statsHistoryDate, ..} ) <$> f statsHistoryDate+{-# INLINE statsHistoryDateL #-}++-- | 'statsHistoryRootSymbol' Lens+statsHistoryRootSymbolL :: Lens_' StatsHistory (Text)+statsHistoryRootSymbolL f StatsHistory{..} = (\statsHistoryRootSymbol -> StatsHistory { statsHistoryRootSymbol, ..} ) <$> f statsHistoryRootSymbol+{-# INLINE statsHistoryRootSymbolL #-}++-- | 'statsHistoryCurrency' Lens+statsHistoryCurrencyL :: Lens_' StatsHistory (Maybe Text)+statsHistoryCurrencyL f StatsHistory{..} = (\statsHistoryCurrency -> StatsHistory { statsHistoryCurrency, ..} ) <$> f statsHistoryCurrency+{-# INLINE statsHistoryCurrencyL #-}++-- | 'statsHistoryVolume' Lens+statsHistoryVolumeL :: Lens_' StatsHistory (Maybe Double)+statsHistoryVolumeL f StatsHistory{..} = (\statsHistoryVolume -> StatsHistory { statsHistoryVolume, ..} ) <$> f statsHistoryVolume+{-# INLINE statsHistoryVolumeL #-}++-- | 'statsHistoryTurnover' Lens+statsHistoryTurnoverL :: Lens_' StatsHistory (Maybe Double)+statsHistoryTurnoverL f StatsHistory{..} = (\statsHistoryTurnover -> StatsHistory { statsHistoryTurnover, ..} ) <$> f statsHistoryTurnover+{-# INLINE statsHistoryTurnoverL #-}++++-- * StatsUSD++-- | 'statsUSDRootSymbol' Lens+statsUSDRootSymbolL :: Lens_' StatsUSD (Text)+statsUSDRootSymbolL f StatsUSD{..} = (\statsUSDRootSymbol -> StatsUSD { statsUSDRootSymbol, ..} ) <$> f statsUSDRootSymbol+{-# INLINE statsUSDRootSymbolL #-}++-- | 'statsUSDCurrency' Lens+statsUSDCurrencyL :: Lens_' StatsUSD (Maybe Text)+statsUSDCurrencyL f StatsUSD{..} = (\statsUSDCurrency -> StatsUSD { statsUSDCurrency, ..} ) <$> f statsUSDCurrency+{-# INLINE statsUSDCurrencyL #-}++-- | 'statsUSDTurnover24h' Lens+statsUSDTurnover24hL :: Lens_' StatsUSD (Maybe Double)+statsUSDTurnover24hL f StatsUSD{..} = (\statsUSDTurnover24h -> StatsUSD { statsUSDTurnover24h, ..} ) <$> f statsUSDTurnover24h+{-# INLINE statsUSDTurnover24hL #-}++-- | 'statsUSDTurnover30d' Lens+statsUSDTurnover30dL :: Lens_' StatsUSD (Maybe Double)+statsUSDTurnover30dL f StatsUSD{..} = (\statsUSDTurnover30d -> StatsUSD { statsUSDTurnover30d, ..} ) <$> f statsUSDTurnover30d+{-# INLINE statsUSDTurnover30dL #-}++-- | 'statsUSDTurnover365d' Lens+statsUSDTurnover365dL :: Lens_' StatsUSD (Maybe Double)+statsUSDTurnover365dL f StatsUSD{..} = (\statsUSDTurnover365d -> StatsUSD { statsUSDTurnover365d, ..} ) <$> f statsUSDTurnover365d+{-# INLINE statsUSDTurnover365dL #-}++-- | 'statsUSDTurnover' Lens+statsUSDTurnoverL :: Lens_' StatsUSD (Maybe Double)+statsUSDTurnoverL f StatsUSD{..} = (\statsUSDTurnover -> StatsUSD { statsUSDTurnover, ..} ) <$> f statsUSDTurnover+{-# INLINE statsUSDTurnoverL #-}++++-- * Trade++-- | 'tradeTimestamp' Lens+tradeTimestampL :: Lens_' Trade (DateTime)+tradeTimestampL f Trade{..} = (\tradeTimestamp -> Trade { tradeTimestamp, ..} ) <$> f tradeTimestamp+{-# INLINE tradeTimestampL #-}++-- | 'tradeSymbol' Lens+tradeSymbolL :: Lens_' Trade (Text)+tradeSymbolL f Trade{..} = (\tradeSymbol -> Trade { tradeSymbol, ..} ) <$> f tradeSymbol+{-# INLINE tradeSymbolL #-}++-- | 'tradeSide' Lens+tradeSideL :: Lens_' Trade (Maybe Text)+tradeSideL f Trade{..} = (\tradeSide -> Trade { tradeSide, ..} ) <$> f tradeSide+{-# INLINE tradeSideL #-}++-- | 'tradeSize' Lens+tradeSizeL :: Lens_' Trade (Maybe Double)+tradeSizeL f Trade{..} = (\tradeSize -> Trade { tradeSize, ..} ) <$> f tradeSize+{-# INLINE tradeSizeL #-}++-- | 'tradePrice' Lens+tradePriceL :: Lens_' Trade (Maybe Double)+tradePriceL f Trade{..} = (\tradePrice -> Trade { tradePrice, ..} ) <$> f tradePrice+{-# INLINE tradePriceL #-}++-- | 'tradeTickDirection' Lens+tradeTickDirectionL :: Lens_' Trade (Maybe Text)+tradeTickDirectionL f Trade{..} = (\tradeTickDirection -> Trade { tradeTickDirection, ..} ) <$> f tradeTickDirection+{-# INLINE tradeTickDirectionL #-}++-- | 'tradeTrdMatchId' Lens+tradeTrdMatchIdL :: Lens_' Trade (Maybe Text)+tradeTrdMatchIdL f Trade{..} = (\tradeTrdMatchId -> Trade { tradeTrdMatchId, ..} ) <$> f tradeTrdMatchId+{-# INLINE tradeTrdMatchIdL #-}++-- | 'tradeGrossValue' Lens+tradeGrossValueL :: Lens_' Trade (Maybe Double)+tradeGrossValueL f Trade{..} = (\tradeGrossValue -> Trade { tradeGrossValue, ..} ) <$> f tradeGrossValue+{-# INLINE tradeGrossValueL #-}++-- | 'tradeHomeNotional' Lens+tradeHomeNotionalL :: Lens_' Trade (Maybe Double)+tradeHomeNotionalL f Trade{..} = (\tradeHomeNotional -> Trade { tradeHomeNotional, ..} ) <$> f tradeHomeNotional+{-# INLINE tradeHomeNotionalL #-}++-- | 'tradeForeignNotional' Lens+tradeForeignNotionalL :: Lens_' Trade (Maybe Double)+tradeForeignNotionalL f Trade{..} = (\tradeForeignNotional -> Trade { tradeForeignNotional, ..} ) <$> f tradeForeignNotional+{-# INLINE tradeForeignNotionalL #-}++++-- * TradeBin++-- | 'tradeBinTimestamp' Lens+tradeBinTimestampL :: Lens_' TradeBin (DateTime)+tradeBinTimestampL f TradeBin{..} = (\tradeBinTimestamp -> TradeBin { tradeBinTimestamp, ..} ) <$> f tradeBinTimestamp+{-# INLINE tradeBinTimestampL #-}++-- | 'tradeBinSymbol' Lens+tradeBinSymbolL :: Lens_' TradeBin (Text)+tradeBinSymbolL f TradeBin{..} = (\tradeBinSymbol -> TradeBin { tradeBinSymbol, ..} ) <$> f tradeBinSymbol+{-# INLINE tradeBinSymbolL #-}++-- | 'tradeBinOpen' Lens+tradeBinOpenL :: Lens_' TradeBin (Maybe Double)+tradeBinOpenL f TradeBin{..} = (\tradeBinOpen -> TradeBin { tradeBinOpen, ..} ) <$> f tradeBinOpen+{-# INLINE tradeBinOpenL #-}++-- | 'tradeBinHigh' Lens+tradeBinHighL :: Lens_' TradeBin (Maybe Double)+tradeBinHighL f TradeBin{..} = (\tradeBinHigh -> TradeBin { tradeBinHigh, ..} ) <$> f tradeBinHigh+{-# INLINE tradeBinHighL #-}++-- | 'tradeBinLow' Lens+tradeBinLowL :: Lens_' TradeBin (Maybe Double)+tradeBinLowL f TradeBin{..} = (\tradeBinLow -> TradeBin { tradeBinLow, ..} ) <$> f tradeBinLow+{-# INLINE tradeBinLowL #-}++-- | 'tradeBinClose' Lens+tradeBinCloseL :: Lens_' TradeBin (Maybe Double)+tradeBinCloseL f TradeBin{..} = (\tradeBinClose -> TradeBin { tradeBinClose, ..} ) <$> f tradeBinClose+{-# INLINE tradeBinCloseL #-}++-- | 'tradeBinTrades' Lens+tradeBinTradesL :: Lens_' TradeBin (Maybe Double)+tradeBinTradesL f TradeBin{..} = (\tradeBinTrades -> TradeBin { tradeBinTrades, ..} ) <$> f tradeBinTrades+{-# INLINE tradeBinTradesL #-}++-- | 'tradeBinVolume' Lens+tradeBinVolumeL :: Lens_' TradeBin (Maybe Double)+tradeBinVolumeL f TradeBin{..} = (\tradeBinVolume -> TradeBin { tradeBinVolume, ..} ) <$> f tradeBinVolume+{-# INLINE tradeBinVolumeL #-}++-- | 'tradeBinVwap' Lens+tradeBinVwapL :: Lens_' TradeBin (Maybe Double)+tradeBinVwapL f TradeBin{..} = (\tradeBinVwap -> TradeBin { tradeBinVwap, ..} ) <$> f tradeBinVwap+{-# INLINE tradeBinVwapL #-}++-- | 'tradeBinLastSize' Lens+tradeBinLastSizeL :: Lens_' TradeBin (Maybe Double)+tradeBinLastSizeL f TradeBin{..} = (\tradeBinLastSize -> TradeBin { tradeBinLastSize, ..} ) <$> f tradeBinLastSize+{-# INLINE tradeBinLastSizeL #-}++-- | 'tradeBinTurnover' Lens+tradeBinTurnoverL :: Lens_' TradeBin (Maybe Double)+tradeBinTurnoverL f TradeBin{..} = (\tradeBinTurnover -> TradeBin { tradeBinTurnover, ..} ) <$> f tradeBinTurnover+{-# INLINE tradeBinTurnoverL #-}++-- | 'tradeBinHomeNotional' Lens+tradeBinHomeNotionalL :: Lens_' TradeBin (Maybe Double)+tradeBinHomeNotionalL f TradeBin{..} = (\tradeBinHomeNotional -> TradeBin { tradeBinHomeNotional, ..} ) <$> f tradeBinHomeNotional+{-# INLINE tradeBinHomeNotionalL #-}++-- | 'tradeBinForeignNotional' Lens+tradeBinForeignNotionalL :: Lens_' TradeBin (Maybe Double)+tradeBinForeignNotionalL f TradeBin{..} = (\tradeBinForeignNotional -> TradeBin { tradeBinForeignNotional, ..} ) <$> f tradeBinForeignNotional+{-# INLINE tradeBinForeignNotionalL #-}++++-- * Transaction++-- | 'transactionTransactId' Lens+transactionTransactIdL :: Lens_' Transaction (Text)+transactionTransactIdL f Transaction{..} = (\transactionTransactId -> Transaction { transactionTransactId, ..} ) <$> f transactionTransactId+{-# INLINE transactionTransactIdL #-}++-- | 'transactionAccount' Lens+transactionAccountL :: Lens_' Transaction (Maybe Double)+transactionAccountL f Transaction{..} = (\transactionAccount -> Transaction { transactionAccount, ..} ) <$> f transactionAccount+{-# INLINE transactionAccountL #-}++-- | 'transactionCurrency' Lens+transactionCurrencyL :: Lens_' Transaction (Maybe Text)+transactionCurrencyL f Transaction{..} = (\transactionCurrency -> Transaction { transactionCurrency, ..} ) <$> f transactionCurrency+{-# INLINE transactionCurrencyL #-}++-- | 'transactionTransactType' Lens+transactionTransactTypeL :: Lens_' Transaction (Maybe Text)+transactionTransactTypeL f Transaction{..} = (\transactionTransactType -> Transaction { transactionTransactType, ..} ) <$> f transactionTransactType+{-# INLINE transactionTransactTypeL #-}++-- | 'transactionAmount' Lens+transactionAmountL :: Lens_' Transaction (Maybe Double)+transactionAmountL f Transaction{..} = (\transactionAmount -> Transaction { transactionAmount, ..} ) <$> f transactionAmount+{-# INLINE transactionAmountL #-}++-- | 'transactionFee' Lens+transactionFeeL :: Lens_' Transaction (Maybe Double)+transactionFeeL f Transaction{..} = (\transactionFee -> Transaction { transactionFee, ..} ) <$> f transactionFee+{-# INLINE transactionFeeL #-}++-- | 'transactionTransactStatus' Lens+transactionTransactStatusL :: Lens_' Transaction (Maybe Text)+transactionTransactStatusL f Transaction{..} = (\transactionTransactStatus -> Transaction { transactionTransactStatus, ..} ) <$> f transactionTransactStatus+{-# INLINE transactionTransactStatusL #-}++-- | 'transactionAddress' Lens+transactionAddressL :: Lens_' Transaction (Maybe Text)+transactionAddressL f Transaction{..} = (\transactionAddress -> Transaction { transactionAddress, ..} ) <$> f transactionAddress+{-# INLINE transactionAddressL #-}++-- | 'transactionTx' Lens+transactionTxL :: Lens_' Transaction (Maybe Text)+transactionTxL f Transaction{..} = (\transactionTx -> Transaction { transactionTx, ..} ) <$> f transactionTx+{-# INLINE transactionTxL #-}++-- | 'transactionText' Lens+transactionTextL :: Lens_' Transaction (Maybe Text)+transactionTextL f Transaction{..} = (\transactionText -> Transaction { transactionText, ..} ) <$> f transactionText+{-# INLINE transactionTextL #-}++-- | 'transactionTransactTime' Lens+transactionTransactTimeL :: Lens_' Transaction (Maybe DateTime)+transactionTransactTimeL f Transaction{..} = (\transactionTransactTime -> Transaction { transactionTransactTime, ..} ) <$> f transactionTransactTime+{-# INLINE transactionTransactTimeL #-}++-- | 'transactionTimestamp' Lens+transactionTimestampL :: Lens_' Transaction (Maybe DateTime)+transactionTimestampL f Transaction{..} = (\transactionTimestamp -> Transaction { transactionTimestamp, ..} ) <$> f transactionTimestamp+{-# INLINE transactionTimestampL #-}++++-- * User++-- | 'userId' Lens+userIdL :: Lens_' User (Maybe Double)+userIdL f User{..} = (\userId -> User { userId, ..} ) <$> f userId+{-# INLINE userIdL #-}++-- | 'userOwnerId' Lens+userOwnerIdL :: Lens_' User (Maybe Double)+userOwnerIdL f User{..} = (\userOwnerId -> User { userOwnerId, ..} ) <$> f userOwnerId+{-# INLINE userOwnerIdL #-}++-- | 'userFirstname' Lens+userFirstnameL :: Lens_' User (Maybe Text)+userFirstnameL f User{..} = (\userFirstname -> User { userFirstname, ..} ) <$> f userFirstname+{-# INLINE userFirstnameL #-}++-- | 'userLastname' Lens+userLastnameL :: Lens_' User (Maybe Text)+userLastnameL f User{..} = (\userLastname -> User { userLastname, ..} ) <$> f userLastname+{-# INLINE userLastnameL #-}++-- | 'userUsername' Lens+userUsernameL :: Lens_' User (Text)+userUsernameL f User{..} = (\userUsername -> User { userUsername, ..} ) <$> f userUsername+{-# INLINE userUsernameL #-}++-- | 'userEmail' Lens+userEmailL :: Lens_' User (Text)+userEmailL f User{..} = (\userEmail -> User { userEmail, ..} ) <$> f userEmail+{-# INLINE userEmailL #-}++-- | 'userPhone' Lens+userPhoneL :: Lens_' User (Maybe Text)+userPhoneL f User{..} = (\userPhone -> User { userPhone, ..} ) <$> f userPhone+{-# INLINE userPhoneL #-}++-- | 'userCreated' Lens+userCreatedL :: Lens_' User (Maybe DateTime)+userCreatedL f User{..} = (\userCreated -> User { userCreated, ..} ) <$> f userCreated+{-# INLINE userCreatedL #-}++-- | 'userLastUpdated' Lens+userLastUpdatedL :: Lens_' User (Maybe DateTime)+userLastUpdatedL f User{..} = (\userLastUpdated -> User { userLastUpdated, ..} ) <$> f userLastUpdated+{-# INLINE userLastUpdatedL #-}++-- | 'userPreferences' Lens+userPreferencesL :: Lens_' User (Maybe UserPreferences)+userPreferencesL f User{..} = (\userPreferences -> User { userPreferences, ..} ) <$> f userPreferences+{-# INLINE userPreferencesL #-}++-- | 'userTfaEnabled' Lens+userTfaEnabledL :: Lens_' User (Maybe Text)+userTfaEnabledL f User{..} = (\userTfaEnabled -> User { userTfaEnabled, ..} ) <$> f userTfaEnabled+{-# INLINE userTfaEnabledL #-}++-- | 'userAffiliateId' Lens+userAffiliateIdL :: Lens_' User (Maybe Text)+userAffiliateIdL f User{..} = (\userAffiliateId -> User { userAffiliateId, ..} ) <$> f userAffiliateId+{-# INLINE userAffiliateIdL #-}++-- | 'userPgpPubKey' Lens+userPgpPubKeyL :: Lens_' User (Maybe Text)+userPgpPubKeyL f User{..} = (\userPgpPubKey -> User { userPgpPubKey, ..} ) <$> f userPgpPubKey+{-# INLINE userPgpPubKeyL #-}++-- | 'userCountry' Lens+userCountryL :: Lens_' User (Maybe Text)+userCountryL f User{..} = (\userCountry -> User { userCountry, ..} ) <$> f userCountry+{-# INLINE userCountryL #-}++++-- * UserCommission++-- | 'userCommissionMakerFee' Lens+userCommissionMakerFeeL :: Lens_' UserCommission (Maybe Double)+userCommissionMakerFeeL f UserCommission{..} = (\userCommissionMakerFee -> UserCommission { userCommissionMakerFee, ..} ) <$> f userCommissionMakerFee+{-# INLINE userCommissionMakerFeeL #-}++-- | 'userCommissionTakerFee' Lens+userCommissionTakerFeeL :: Lens_' UserCommission (Maybe Double)+userCommissionTakerFeeL f UserCommission{..} = (\userCommissionTakerFee -> UserCommission { userCommissionTakerFee, ..} ) <$> f userCommissionTakerFee+{-# INLINE userCommissionTakerFeeL #-}++-- | 'userCommissionSettlementFee' Lens+userCommissionSettlementFeeL :: Lens_' UserCommission (Maybe Double)+userCommissionSettlementFeeL f UserCommission{..} = (\userCommissionSettlementFee -> UserCommission { userCommissionSettlementFee, ..} ) <$> f userCommissionSettlementFee+{-# INLINE userCommissionSettlementFeeL #-}++-- | 'userCommissionMaxFee' Lens+userCommissionMaxFeeL :: Lens_' UserCommission (Maybe Double)+userCommissionMaxFeeL f UserCommission{..} = (\userCommissionMaxFee -> UserCommission { userCommissionMaxFee, ..} ) <$> f userCommissionMaxFee+{-# INLINE userCommissionMaxFeeL #-}++++-- * UserPreferences++-- | 'userPreferencesAlertOnLiquidations' Lens+userPreferencesAlertOnLiquidationsL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesAlertOnLiquidationsL f UserPreferences{..} = (\userPreferencesAlertOnLiquidations -> UserPreferences { userPreferencesAlertOnLiquidations, ..} ) <$> f userPreferencesAlertOnLiquidations+{-# INLINE userPreferencesAlertOnLiquidationsL #-}++-- | 'userPreferencesAnimationsEnabled' Lens+userPreferencesAnimationsEnabledL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesAnimationsEnabledL f UserPreferences{..} = (\userPreferencesAnimationsEnabled -> UserPreferences { userPreferencesAnimationsEnabled, ..} ) <$> f userPreferencesAnimationsEnabled+{-# INLINE userPreferencesAnimationsEnabledL #-}++-- | 'userPreferencesAnnouncementsLastSeen' Lens+userPreferencesAnnouncementsLastSeenL :: Lens_' UserPreferences (Maybe DateTime)+userPreferencesAnnouncementsLastSeenL f UserPreferences{..} = (\userPreferencesAnnouncementsLastSeen -> UserPreferences { userPreferencesAnnouncementsLastSeen, ..} ) <$> f userPreferencesAnnouncementsLastSeen+{-# INLINE userPreferencesAnnouncementsLastSeenL #-}++-- | 'userPreferencesChatChannelId' Lens+userPreferencesChatChannelIdL :: Lens_' UserPreferences (Maybe Double)+userPreferencesChatChannelIdL f UserPreferences{..} = (\userPreferencesChatChannelId -> UserPreferences { userPreferencesChatChannelId, ..} ) <$> f userPreferencesChatChannelId+{-# INLINE userPreferencesChatChannelIdL #-}++-- | 'userPreferencesColorTheme' Lens+userPreferencesColorThemeL :: Lens_' UserPreferences (Maybe Text)+userPreferencesColorThemeL f UserPreferences{..} = (\userPreferencesColorTheme -> UserPreferences { userPreferencesColorTheme, ..} ) <$> f userPreferencesColorTheme+{-# INLINE userPreferencesColorThemeL #-}++-- | 'userPreferencesCurrency' Lens+userPreferencesCurrencyL :: Lens_' UserPreferences (Maybe Text)+userPreferencesCurrencyL f UserPreferences{..} = (\userPreferencesCurrency -> UserPreferences { userPreferencesCurrency, ..} ) <$> f userPreferencesCurrency+{-# INLINE userPreferencesCurrencyL #-}++-- | 'userPreferencesDebug' Lens+userPreferencesDebugL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesDebugL f UserPreferences{..} = (\userPreferencesDebug -> UserPreferences { userPreferencesDebug, ..} ) <$> f userPreferencesDebug+{-# INLINE userPreferencesDebugL #-}++-- | 'userPreferencesDisableEmails' Lens+userPreferencesDisableEmailsL :: Lens_' UserPreferences (Maybe [Text])+userPreferencesDisableEmailsL f UserPreferences{..} = (\userPreferencesDisableEmails -> UserPreferences { userPreferencesDisableEmails, ..} ) <$> f userPreferencesDisableEmails+{-# INLINE userPreferencesDisableEmailsL #-}++-- | 'userPreferencesHideConfirmDialogs' Lens+userPreferencesHideConfirmDialogsL :: Lens_' UserPreferences (Maybe [Text])+userPreferencesHideConfirmDialogsL f UserPreferences{..} = (\userPreferencesHideConfirmDialogs -> UserPreferences { userPreferencesHideConfirmDialogs, ..} ) <$> f userPreferencesHideConfirmDialogs+{-# INLINE userPreferencesHideConfirmDialogsL #-}++-- | 'userPreferencesHideConnectionModal' Lens+userPreferencesHideConnectionModalL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesHideConnectionModalL f UserPreferences{..} = (\userPreferencesHideConnectionModal -> UserPreferences { userPreferencesHideConnectionModal, ..} ) <$> f userPreferencesHideConnectionModal+{-# INLINE userPreferencesHideConnectionModalL #-}++-- | 'userPreferencesHideFromLeaderboard' Lens+userPreferencesHideFromLeaderboardL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesHideFromLeaderboardL f UserPreferences{..} = (\userPreferencesHideFromLeaderboard -> UserPreferences { userPreferencesHideFromLeaderboard, ..} ) <$> f userPreferencesHideFromLeaderboard+{-# INLINE userPreferencesHideFromLeaderboardL #-}++-- | 'userPreferencesHideNameFromLeaderboard' Lens+userPreferencesHideNameFromLeaderboardL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesHideNameFromLeaderboardL f UserPreferences{..} = (\userPreferencesHideNameFromLeaderboard -> UserPreferences { userPreferencesHideNameFromLeaderboard, ..} ) <$> f userPreferencesHideNameFromLeaderboard+{-# INLINE userPreferencesHideNameFromLeaderboardL #-}++-- | 'userPreferencesHideNotifications' Lens+userPreferencesHideNotificationsL :: Lens_' UserPreferences (Maybe [Text])+userPreferencesHideNotificationsL f UserPreferences{..} = (\userPreferencesHideNotifications -> UserPreferences { userPreferencesHideNotifications, ..} ) <$> f userPreferencesHideNotifications+{-# INLINE userPreferencesHideNotificationsL #-}++-- | 'userPreferencesLocale' Lens+userPreferencesLocaleL :: Lens_' UserPreferences (Maybe Text)+userPreferencesLocaleL f UserPreferences{..} = (\userPreferencesLocale -> UserPreferences { userPreferencesLocale, ..} ) <$> f userPreferencesLocale+{-# INLINE userPreferencesLocaleL #-}++-- | 'userPreferencesMsgsSeen' Lens+userPreferencesMsgsSeenL :: Lens_' UserPreferences (Maybe [Text])+userPreferencesMsgsSeenL f UserPreferences{..} = (\userPreferencesMsgsSeen -> UserPreferences { userPreferencesMsgsSeen, ..} ) <$> f userPreferencesMsgsSeen+{-# INLINE userPreferencesMsgsSeenL #-}++-- | 'userPreferencesOrderBookBinning' Lens+userPreferencesOrderBookBinningL :: Lens_' UserPreferences (Maybe A.Value)+userPreferencesOrderBookBinningL f UserPreferences{..} = (\userPreferencesOrderBookBinning -> UserPreferences { userPreferencesOrderBookBinning, ..} ) <$> f userPreferencesOrderBookBinning+{-# INLINE userPreferencesOrderBookBinningL #-}++-- | 'userPreferencesOrderBookType' Lens+userPreferencesOrderBookTypeL :: Lens_' UserPreferences (Maybe Text)+userPreferencesOrderBookTypeL f UserPreferences{..} = (\userPreferencesOrderBookType -> UserPreferences { userPreferencesOrderBookType, ..} ) <$> f userPreferencesOrderBookType+{-# INLINE userPreferencesOrderBookTypeL #-}++-- | 'userPreferencesOrderClearImmediate' Lens+userPreferencesOrderClearImmediateL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesOrderClearImmediateL f UserPreferences{..} = (\userPreferencesOrderClearImmediate -> UserPreferences { userPreferencesOrderClearImmediate, ..} ) <$> f userPreferencesOrderClearImmediate+{-# INLINE userPreferencesOrderClearImmediateL #-}++-- | 'userPreferencesOrderControlsPlusMinus' Lens+userPreferencesOrderControlsPlusMinusL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesOrderControlsPlusMinusL f UserPreferences{..} = (\userPreferencesOrderControlsPlusMinus -> UserPreferences { userPreferencesOrderControlsPlusMinus, ..} ) <$> f userPreferencesOrderControlsPlusMinus+{-# INLINE userPreferencesOrderControlsPlusMinusL #-}++-- | 'userPreferencesSounds' Lens+userPreferencesSoundsL :: Lens_' UserPreferences (Maybe [Text])+userPreferencesSoundsL f UserPreferences{..} = (\userPreferencesSounds -> UserPreferences { userPreferencesSounds, ..} ) <$> f userPreferencesSounds+{-# INLINE userPreferencesSoundsL #-}++-- | 'userPreferencesStrictIpCheck' Lens+userPreferencesStrictIpCheckL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesStrictIpCheckL f UserPreferences{..} = (\userPreferencesStrictIpCheck -> UserPreferences { userPreferencesStrictIpCheck, ..} ) <$> f userPreferencesStrictIpCheck+{-# INLINE userPreferencesStrictIpCheckL #-}++-- | 'userPreferencesStrictTimeout' Lens+userPreferencesStrictTimeoutL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesStrictTimeoutL f UserPreferences{..} = (\userPreferencesStrictTimeout -> UserPreferences { userPreferencesStrictTimeout, ..} ) <$> f userPreferencesStrictTimeout+{-# INLINE userPreferencesStrictTimeoutL #-}++-- | 'userPreferencesTickerGroup' Lens+userPreferencesTickerGroupL :: Lens_' UserPreferences (Maybe Text)+userPreferencesTickerGroupL f UserPreferences{..} = (\userPreferencesTickerGroup -> UserPreferences { userPreferencesTickerGroup, ..} ) <$> f userPreferencesTickerGroup+{-# INLINE userPreferencesTickerGroupL #-}++-- | 'userPreferencesTickerPinned' Lens+userPreferencesTickerPinnedL :: Lens_' UserPreferences (Maybe Bool)+userPreferencesTickerPinnedL f UserPreferences{..} = (\userPreferencesTickerPinned -> UserPreferences { userPreferencesTickerPinned, ..} ) <$> f userPreferencesTickerPinned+{-# INLINE userPreferencesTickerPinnedL #-}++-- | 'userPreferencesTradeLayout' Lens+userPreferencesTradeLayoutL :: Lens_' UserPreferences (Maybe Text)+userPreferencesTradeLayoutL f UserPreferences{..} = (\userPreferencesTradeLayout -> UserPreferences { userPreferencesTradeLayout, ..} ) <$> f userPreferencesTradeLayout+{-# INLINE userPreferencesTradeLayoutL #-}++++-- * Wallet++-- | 'walletAccount' Lens+walletAccountL :: Lens_' Wallet (Double)+walletAccountL f Wallet{..} = (\walletAccount -> Wallet { walletAccount, ..} ) <$> f walletAccount+{-# INLINE walletAccountL #-}++-- | 'walletCurrency' Lens+walletCurrencyL :: Lens_' Wallet (Text)+walletCurrencyL f Wallet{..} = (\walletCurrency -> Wallet { walletCurrency, ..} ) <$> f walletCurrency+{-# INLINE walletCurrencyL #-}++-- | 'walletPrevDeposited' Lens+walletPrevDepositedL :: Lens_' Wallet (Maybe Double)+walletPrevDepositedL f Wallet{..} = (\walletPrevDeposited -> Wallet { walletPrevDeposited, ..} ) <$> f walletPrevDeposited+{-# INLINE walletPrevDepositedL #-}++-- | 'walletPrevWithdrawn' Lens+walletPrevWithdrawnL :: Lens_' Wallet (Maybe Double)+walletPrevWithdrawnL f Wallet{..} = (\walletPrevWithdrawn -> Wallet { walletPrevWithdrawn, ..} ) <$> f walletPrevWithdrawn+{-# INLINE walletPrevWithdrawnL #-}++-- | 'walletPrevTransferIn' Lens+walletPrevTransferInL :: Lens_' Wallet (Maybe Double)+walletPrevTransferInL f Wallet{..} = (\walletPrevTransferIn -> Wallet { walletPrevTransferIn, ..} ) <$> f walletPrevTransferIn+{-# INLINE walletPrevTransferInL #-}++-- | 'walletPrevTransferOut' Lens+walletPrevTransferOutL :: Lens_' Wallet (Maybe Double)+walletPrevTransferOutL f Wallet{..} = (\walletPrevTransferOut -> Wallet { walletPrevTransferOut, ..} ) <$> f walletPrevTransferOut+{-# INLINE walletPrevTransferOutL #-}++-- | 'walletPrevAmount' Lens+walletPrevAmountL :: Lens_' Wallet (Maybe Double)+walletPrevAmountL f Wallet{..} = (\walletPrevAmount -> Wallet { walletPrevAmount, ..} ) <$> f walletPrevAmount+{-# INLINE walletPrevAmountL #-}++-- | 'walletPrevTimestamp' Lens+walletPrevTimestampL :: Lens_' Wallet (Maybe DateTime)+walletPrevTimestampL f Wallet{..} = (\walletPrevTimestamp -> Wallet { walletPrevTimestamp, ..} ) <$> f walletPrevTimestamp+{-# INLINE walletPrevTimestampL #-}++-- | 'walletDeltaDeposited' Lens+walletDeltaDepositedL :: Lens_' Wallet (Maybe Double)+walletDeltaDepositedL f Wallet{..} = (\walletDeltaDeposited -> Wallet { walletDeltaDeposited, ..} ) <$> f walletDeltaDeposited+{-# INLINE walletDeltaDepositedL #-}++-- | 'walletDeltaWithdrawn' Lens+walletDeltaWithdrawnL :: Lens_' Wallet (Maybe Double)+walletDeltaWithdrawnL f Wallet{..} = (\walletDeltaWithdrawn -> Wallet { walletDeltaWithdrawn, ..} ) <$> f walletDeltaWithdrawn+{-# INLINE walletDeltaWithdrawnL #-}++-- | 'walletDeltaTransferIn' Lens+walletDeltaTransferInL :: Lens_' Wallet (Maybe Double)+walletDeltaTransferInL f Wallet{..} = (\walletDeltaTransferIn -> Wallet { walletDeltaTransferIn, ..} ) <$> f walletDeltaTransferIn+{-# INLINE walletDeltaTransferInL #-}++-- | 'walletDeltaTransferOut' Lens+walletDeltaTransferOutL :: Lens_' Wallet (Maybe Double)+walletDeltaTransferOutL f Wallet{..} = (\walletDeltaTransferOut -> Wallet { walletDeltaTransferOut, ..} ) <$> f walletDeltaTransferOut+{-# INLINE walletDeltaTransferOutL #-}++-- | 'walletDeltaAmount' Lens+walletDeltaAmountL :: Lens_' Wallet (Maybe Double)+walletDeltaAmountL f Wallet{..} = (\walletDeltaAmount -> Wallet { walletDeltaAmount, ..} ) <$> f walletDeltaAmount+{-# INLINE walletDeltaAmountL #-}++-- | 'walletDeposited' Lens+walletDepositedL :: Lens_' Wallet (Maybe Double)+walletDepositedL f Wallet{..} = (\walletDeposited -> Wallet { walletDeposited, ..} ) <$> f walletDeposited+{-# INLINE walletDepositedL #-}++-- | 'walletWithdrawn' Lens+walletWithdrawnL :: Lens_' Wallet (Maybe Double)+walletWithdrawnL f Wallet{..} = (\walletWithdrawn -> Wallet { walletWithdrawn, ..} ) <$> f walletWithdrawn+{-# INLINE walletWithdrawnL #-}++-- | 'walletTransferIn' Lens+walletTransferInL :: Lens_' Wallet (Maybe Double)+walletTransferInL f Wallet{..} = (\walletTransferIn -> Wallet { walletTransferIn, ..} ) <$> f walletTransferIn+{-# INLINE walletTransferInL #-}++-- | 'walletTransferOut' Lens+walletTransferOutL :: Lens_' Wallet (Maybe Double)+walletTransferOutL f Wallet{..} = (\walletTransferOut -> Wallet { walletTransferOut, ..} ) <$> f walletTransferOut+{-# INLINE walletTransferOutL #-}++-- | 'walletAmount' Lens+walletAmountL :: Lens_' Wallet (Maybe Double)+walletAmountL f Wallet{..} = (\walletAmount -> Wallet { walletAmount, ..} ) <$> f walletAmount+{-# INLINE walletAmountL #-}++-- | 'walletPendingCredit' Lens+walletPendingCreditL :: Lens_' Wallet (Maybe Double)+walletPendingCreditL f Wallet{..} = (\walletPendingCredit -> Wallet { walletPendingCredit, ..} ) <$> f walletPendingCredit+{-# INLINE walletPendingCreditL #-}++-- | 'walletPendingDebit' Lens+walletPendingDebitL :: Lens_' Wallet (Maybe Double)+walletPendingDebitL f Wallet{..} = (\walletPendingDebit -> Wallet { walletPendingDebit, ..} ) <$> f walletPendingDebit+{-# INLINE walletPendingDebitL #-}++-- | 'walletConfirmedDebit' Lens+walletConfirmedDebitL :: Lens_' Wallet (Maybe Double)+walletConfirmedDebitL f Wallet{..} = (\walletConfirmedDebit -> Wallet { walletConfirmedDebit, ..} ) <$> f walletConfirmedDebit+{-# INLINE walletConfirmedDebitL #-}++-- | 'walletTimestamp' Lens+walletTimestampL :: Lens_' Wallet (Maybe DateTime)+walletTimestampL f Wallet{..} = (\walletTimestamp -> Wallet { walletTimestamp, ..} ) <$> f walletTimestamp+{-# INLINE walletTimestampL #-}++-- | 'walletAddr' Lens+walletAddrL :: Lens_' Wallet (Maybe Text)+walletAddrL f Wallet{..} = (\walletAddr -> Wallet { walletAddr, ..} ) <$> f walletAddr+{-# INLINE walletAddrL #-}++-- | 'walletScript' Lens+walletScriptL :: Lens_' Wallet (Maybe Text)+walletScriptL f Wallet{..} = (\walletScript -> Wallet { walletScript, ..} ) <$> f walletScript+{-# INLINE walletScriptL #-}++-- | 'walletWithdrawalLock' Lens+walletWithdrawalLockL :: Lens_' Wallet (Maybe [Text])+walletWithdrawalLockL f Wallet{..} = (\walletWithdrawalLock -> Wallet { walletWithdrawalLock, ..} ) <$> f walletWithdrawalLock+{-# INLINE walletWithdrawalLockL #-}++++-- * XAny++
+ swagger.yaml view
@@ -0,0 +1,6077 @@+---+swagger: "2.0"+info:+ description: "## REST API for the BitMEX Trading Platform\n\n[View Changelog](/app/apiChangelog)\n\+ \n\n\n#### Getting Started\n\n\n##### Fetching Data\n\nAll REST endpoints are\+ \ documented below. You can try out any query right from this interface.\n\nMost\+ \ table queries accept `count`, `start`, and `reverse` params. Set `reverse=true`\+ \ to get rows newest-first.\n\nAdditional documentation regarding filters, timestamps,\+ \ and authentication\nis available in [the main API documentation](https://www.bitmex.com/app/restAPI).\n\+ \n*All* table data is available via the [Websocket](/app/wsAPI). We highly recommend\+ \ using the socket if you want\nto have the quickest possible data without being\+ \ subject to ratelimits.\n\n##### Return Types\n\nBy default, all data is returned\+ \ as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data.\n\+ \n##### Trade Data Queries\n\n*This is only a small subset of what is available,\+ \ to get you started.*\n\nFill in the parameters and click the `Try it out!` button\+ \ to try any of these queries.\n\n* [Pricing Data](#!/Quote/Quote_get)\n\n* [Trade\+ \ Data](#!/Trade/Trade_get)\n\n* [OrderBook Data](#!/OrderBook/OrderBook_getL2)\n\+ \n* [Settlement Data](#!/Settlement/Settlement_get)\n\n* [Exchange Statistics](#!/Stats/Stats_history)\n\+ \nEvery function of the BitMEX.com platform is exposed here and documented. Many\+ \ more functions are available.\n\n##### Swagger Specification\n\n[⇩ Download\+ \ Swagger JSON](swagger.json)\n\n\n\n## All API Endpoints\n\nClick to expand a\+ \ section.\n"+ version: "1.2.0"+ title: "BitMEX API"+ termsOfService: "https://www.bitmex.com/app/terms"+ contact:+ email: "support@bitmex.com"+basePath: "/api/v1"+tags:+- name: "Announcement"+ description: "Public Announcements"+- name: "APIKey"+ description: "Persistent API Keys for Developers"+- name: "Chat"+ description: "Trollbox Data"+- name: "Execution"+ description: "Raw Order and Balance Data"+- name: "Funding"+ description: "Swap Funding History"+- name: "Instrument"+ description: "Tradeable Contracts, Indices, and History"+- name: "Insurance"+ description: "Insurance Fund Data"+- name: "Leaderboard"+ description: "Information on Top Users"+- name: "Liquidation"+ description: "Active Liquidations"+- name: "Notification"+ description: "Account Notifications"+- name: "Order"+ description: "Placement, Cancellation, Amending, and History"+- name: "OrderBook"+ description: "Level 2 Book Data"+- name: "Position"+ description: "Summary of Open and Closed Positions"+- name: "Quote"+ description: "Best Bid/Offer Snapshots & Historical Bins"+- name: "Schema"+ description: "Dynamic Schemata for Developers"+- name: "Settlement"+ description: "Historical Settlement Data"+- name: "Stats"+ description: "Exchange Statistics"+- name: "Trade"+ description: "Individual & Bucketed Trades"+- name: "User"+ description: "Account Operations"+consumes:+- "application/json"+- "application/x-www-form-urlencoded"+produces:+- "application/json"+- "application/xml"+- "text/xml"+- "application/javascript"+- "text/javascript"+security:+- apiKey: []+ apiSignature: []+ apiNonce: []+paths:+ /announcement:+ get:+ tags:+ - "Announcement"+ summary: "Get site announcements."+ operationId: "Announcement.get"+ parameters:+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns."+ required: false+ type: "string"+ format: "JSON"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Announcement"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /announcement/urgent:+ get:+ tags:+ - "Announcement"+ summary: "Get urgent (banner) announcements."+ operationId: "Announcement.getUrgent"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Announcement"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /apiKey:+ get:+ tags:+ - "APIKey"+ summary: "Get your API Keys."+ operationId: "APIKey.get"+ parameters:+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/APIKey"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ post:+ tags:+ - "APIKey"+ summary: "Create a new API Key."+ description: "API Keys can also be created via [this Python script](https://github.com/BitMEX/market-maker/blob/master/generate-api-key.py)\+ \ See the [API Key Documentation](/app/apiKeys) for more information on capabilities."+ operationId: "APIKey.new"+ parameters:+ - name: "name"+ in: "formData"+ description: "Key name. This name is for reference only."+ required: false+ type: "string"+ - name: "cidr"+ in: "formData"+ description: "CIDR block to restrict this key to. To restrict to a single\+ \ address, append \"/32\", e.g. 207.39.29.22/32. Leave blank or set to 0.0.0.0/0\+ \ to allow all IPs. Only one block may be set. <a href=\"http://software77.net/cidr-101.html\"\+ >More on CIDR blocks</a>"+ required: false+ type: "string"+ - name: "permissions"+ in: "formData"+ description: "Key Permissions. All keys can read margin and position data.\+ \ Additional permissions must be added. Available: [\"order\", \"orderCancel\"\+ , \"withdraw\"]."+ required: false+ type: "string"+ format: "JSON"+ - name: "enabled"+ in: "formData"+ description: "Set to true to enable this key on creation. Otherwise, it must\+ \ be explicitly enabled via /apiKey/enable."+ required: false+ type: "boolean"+ default: false+ - name: "token"+ in: "formData"+ description: "OTP Token (YubiKey, Google Authenticator)"+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/APIKey"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ delete:+ tags:+ - "APIKey"+ summary: "Remove an API Key."+ operationId: "APIKey.remove"+ parameters:+ - name: "apiKeyID"+ in: "formData"+ description: "API Key ID (public component)."+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/inline_response_200"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /apiKey/disable:+ post:+ tags:+ - "APIKey"+ summary: "Disable an API Key."+ operationId: "APIKey.disable"+ parameters:+ - name: "apiKeyID"+ in: "formData"+ description: "API Key ID (public component)."+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/APIKey"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /apiKey/enable:+ post:+ tags:+ - "APIKey"+ summary: "Enable an API Key."+ operationId: "APIKey.enable"+ parameters:+ - name: "apiKeyID"+ in: "formData"+ description: "API Key ID (public component)."+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/APIKey"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /chat:+ get:+ tags:+ - "Chat"+ summary: "Get chat messages."+ operationId: "Chat.get"+ parameters:+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting ID for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: true+ - name: "channelID"+ in: "query"+ description: "Channel id. GET /chat/channels for ids. Leave blank for all."+ required: false+ type: "number"+ format: "double"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Chat"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ post:+ tags:+ - "Chat"+ summary: "Send a chat message."+ operationId: "Chat.new"+ parameters:+ - name: "message"+ in: "formData"+ required: true+ type: "string"+ - name: "channelID"+ in: "formData"+ description: "Channel to post to. Default 1 (English)."+ required: false+ type: "number"+ default: 1+ format: "double"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Chat"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /chat/channels:+ get:+ tags:+ - "Chat"+ summary: "Get available channels."+ operationId: "Chat.getChannels"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/ChatChannels"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /chat/connected:+ get:+ tags:+ - "Chat"+ summary: "Get connected users."+ description: "Returns an array with browser users in the first position and\+ \ API users (bots) in the second position."+ operationId: "Chat.getConnected"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/ConnectedUsers"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /execution:+ get:+ tags:+ - "Execution"+ summary: "Get all raw executions for your account."+ description: "This returns all raw transactions, which includes order opening\+ \ and cancelation, and order status\nchanges. It can be quite noisy. More\+ \ focused information is available at `/execution/tradeHistory`.\n\nYou may\+ \ also use the `filter` param to target your query. Specify an array as a\+ \ filter value, such as\n`{\"execType\": [\"Settlement\", \"Trade\"]}` to\+ \ filter on multiple values.\n\nSee [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_8_8.html)\+ \ for explanations of these fields.\n"+ operationId: "Execution.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Execution"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /execution/tradeHistory:+ get:+ tags:+ - "Execution"+ summary: "Get all balance-affecting executions. This includes each trade, insurance\+ \ charge, and settlement."+ operationId: "Execution.getTradeHistory"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Execution"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /funding:+ get:+ tags:+ - "Funding"+ summary: "Get funding history."+ operationId: "Funding.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Funding"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /instrument:+ get:+ tags:+ - "Instrument"+ summary: "Get instruments."+ description: "This returns all instruments and indices, including those that\+ \ have settled or are unlisted. Use this endpoint if you want to query for\+ \ individual instruments or use a complex filter. Use `/instrument/active`\+ \ to return active instruments, or use a filter like `{\"state\": \"Open\"\+ }`."+ operationId: "Instrument.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Instrument"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /instrument/active:+ get:+ tags:+ - "Instrument"+ summary: "Get all active instruments and instruments that have expired in <24hrs."+ operationId: "Instrument.getActive"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Instrument"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /instrument/indices:+ get:+ tags:+ - "Instrument"+ summary: "Get all price indices."+ operationId: "Instrument.getIndices"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Instrument"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /instrument/activeAndIndices:+ get:+ tags:+ - "Instrument"+ summary: "Helper method. Gets all active instruments and all indices. This is\+ \ a join of the result of /indices and /active."+ operationId: "Instrument.getActiveAndIndices"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Instrument"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /instrument/activeIntervals:+ get:+ tags:+ - "Instrument"+ summary: "Return all active contract series and interval pairs."+ description: "This endpoint is useful for determining which pairs are live.\+ \ It returns two arrays of strings. The first is intervals, such as `[\"\+ BVOL:daily\", \"BVOL:weekly\", \"XBU:daily\", \"XBU:monthly\", ...]`. These\+ \ identifiers are usable in any query's `symbol` param. The second array is\+ \ the current resolution of these intervals. Results are mapped at the same\+ \ index."+ operationId: "Instrument.getActiveIntervals"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/InstrumentInterval"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /instrument/compositeIndex:+ get:+ tags:+ - "Instrument"+ summary: "Show constituent parts of an index."+ description: "Composite indices are built from multiple external price sources.\n\+ \nUse this endpoint to get the underlying prices of an index. For example,\+ \ send a `symbol` of `.XBT` to\nget the ticks and weights of the constituent\+ \ exchanges that build the \".XBT\" index.\n\nA tick with reference `\"BMI\"\+ ` and weight `null` is the composite index tick.\n"+ operationId: "Instrument.getCompositeIndex"+ parameters:+ - name: "account"+ in: "query"+ required: false+ type: "number"+ format: "double"+ - name: "symbol"+ in: "query"+ description: "The composite index symbol."+ required: false+ type: "string"+ default: ".XBT"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/IndexComposite"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /insurance:+ get:+ tags:+ - "Insurance"+ summary: "Get insurance fund history."+ operationId: "Insurance.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Insurance"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /leaderboard:+ get:+ tags:+ - "Leaderboard"+ summary: "Get current leaderboard."+ operationId: "Leaderboard.get"+ parameters:+ - name: "method"+ in: "query"+ description: "Ranking type. Options: \"notional\", \"ROE\""+ required: false+ type: "string"+ default: "notional"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Leaderboard"+ security: []+ /liquidation:+ get:+ tags:+ - "Liquidation"+ summary: "Get liquidation orders."+ operationId: "Liquidation.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Liquidation"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /notification:+ get:+ tags:+ - "Notification"+ summary: "Get your current notifications."+ description: "This is an upcoming feature and currently does not return data."+ operationId: "Notification.get"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Notification"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /order:+ get:+ tags:+ - "Order"+ summary: "Get your orders."+ description: "To get open orders only, send {\"open\": true} in the filter param.\n\+ \nSee <a href=\"http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_D_68.html\"\+ >the FIX Spec</a> for explanations of these fields."+ operationId: "Order.getOrders"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ post:+ tags:+ - "Order"+ summary: "Create a new order."+ description: "## Placing Orders\n\nThis endpoint is used for placing orders.\+ \ See individual fields below for more details on their use.\n\n#### Order\+ \ Types\n\nAll orders require a `symbol`. All other fields are optional except\+ \ when otherwise specified.\n\nThese are the valid `ordType`s:\n\n* **Limit**:\+ \ The default order type. Specify an `orderQty` and `price`.\n* **Market**:\+ \ A traditional Market order. A Market order will execute until filled or\+ \ your bankruptcy price is reached, at\n which point it will cancel.\n* **MarketWithLeftOverAsLimit**:\+ \ A market order that, after eating through the order book as far as\n permitted\+ \ by available margin, will become a limit order. The difference between this\+ \ type and `Market` only\n affects the behavior in thin books. Upon reaching\+ \ the deepest possible price, if there is quantity left over,\n a `Market`\+ \ order will cancel the remaining quantity. `MarketWithLeftOverAsLimit` will\+ \ keep the remaining\n quantity in the books as a `Limit`.\n* **Stop**: A\+ \ Stop Market order. Specify an `orderQty` and `stopPx`. When the `stopPx`\+ \ is reached, the order will be entered\n into the book.\n * On sell orders,\+ \ the order will trigger if the triggering price is lower than the `stopPx`.\+ \ On buys, higher.\n * Note: Stop orders do not consume margin until triggered.\+ \ Be sure that the required margin is available in your\n account so that\+ \ it may trigger fully.\n * `Close` Stops don't require an `orderQty`. See\+ \ Execution Instructions below.\n* **StopLimit**: Like a Stop Market, but\+ \ enters a Limit order instead of a Market order. Specify an `orderQty`, `stopPx`,\n\+ \ and `price`.\n* **MarketIfTouched**: Similar to a Stop, but triggers are\+ \ done in the opposite direction. Useful for Take Profit orders.\n* **LimitIfTouched**:\+ \ As above; use for Take Profit Limit orders.\n\n#### Execution Instructions\n\+ \nThe following `execInst`s are supported. If using multiple, separate with\+ \ a comma (e.g. `LastPrice,Close`).\n\n* **ParticipateDoNotInitiate**: Also\+ \ known as a Post-Only order. If this order would have executed on placement,\n\+ \ it will cancel instead.\n* **AllOrNone**: Valid only for hidden orders\+ \ (`displayQty: 0`). Use to only execute if the entire order would fill.\n\+ * **MarkPrice, LastPrice, IndexPrice**: Used by stop and if-touched orders\+ \ to determine the triggering price.\n Use only one. By default, `'MarkPrice'`\+ \ is used. Also used for Pegged orders to define the value of `'LastPeg'`.\n\+ * **ReduceOnly**: A `'ReduceOnly'` order can only reduce your position, not\+ \ increase it. If you have a `'ReduceOnly'`\n limit order that rests in the\+ \ order book while the position is reduced by other orders, then its order\+ \ quantity will\n be amended down or canceled. If there are multiple `'ReduceOnly'`\+ \ orders the least agresssive will be amended first.\n* **Close**: `'Close'`\+ \ implies `'ReduceOnly'`. A `'Close'` order will cancel other active limit\+ \ orders with the same side\n and symbol if the open quantity exceeds the\+ \ current position. This is useful for stops: by canceling these orders, a\n\+ \ `'Close'` Stop is ensured to have the margin required to execute, and can\+ \ only execute up to the full size of your\n position. If not specified,\+ \ a `'Close'` order has an `orderQty` equal to your current position's size.\n\+ \n#### Linked Orders\n\nLinked Orders are an advanced capability. It is very\+ \ powerful, but its use requires careful coding and testing.\nPlease follow\+ \ this document carefully and use the [Testnet Exchange](https://testnet.bitmex.com)\+ \ while developing.\n\nBitMEX offers four advanced Linked Order types:\n\n\+ * **OCO**: *One Cancels the Other*. A very flexible version of the standard\+ \ Stop / Take Profit technique.\n Multiple orders may be linked together\+ \ using a single `clOrdLinkID`. Send a `contingencyType` of\n `OneCancelsTheOther`\+ \ on the orders. The first order that fully or partially executes (or activates\n\+ \ for `Stop` orders) will cancel all other orders with the same `clOrdLinkID`.\n\+ * **OTO**: *One Triggers the Other*. Send a `contingencyType` of `'OneTriggersTheOther'`\+ \ on the primary order and\n then subsequent orders with the same `clOrdLinkID`\+ \ will be not be triggered until the primary order fully executes.\n* **OUOA**:\+ \ *One Updates the Other Absolute*. Send a `contingencyType` of `'OneUpdatesTheOtherAbsolute'`\+ \ on the orders. Then\n as one order has a execution, other orders with the\+ \ same `clOrdLinkID` will have their order quantity amended\n down by the\+ \ execution quantity.\n* **OUOP**: *One Updates the Other Proportional*. Send\+ \ a `contingencyType` of `'OneUpdatesTheOtherProportional'` on the orders.\+ \ Then\n as one order has a execution, other orders with the same `clOrdLinkID`\+ \ will have their order quantity reduced proportionally\n by the fill percentage.\n\+ \n#### Trailing Stops\n\nYou may use `pegPriceType` of `'TrailingStopPeg'`\+ \ to create Trailing Stops. The pegged `stopPx` will move as the market\n\+ moves away from the peg, and freeze as the market moves toward it.\n\nTo use,\+ \ combine with `pegOffsetValue` to set the `stopPx` of your order. The peg\+ \ is set to the triggering price\nspecified in the `execInst` (default `'MarkPrice'`).\+ \ Use a negative offset for stop-sell and buy-if-touched orders.\n\nRequires\+ \ `ordType`: `'Stop', 'StopLimit', 'MarketIfTouched', 'LimitIfTouched'`.\n\+ \n#### Simple Quantities\n\nSend a `simpleOrderQty` instead of an `orderQty`\+ \ to create an order denominated in the underlying currency.\nThis is useful\+ \ for opening up a position with 1 XBT of exposure without having to calculate\+ \ how many contracts it is.\n\n#### Rate Limits\n\nSee the [Bulk Order Documentation](#!/Order/Order_newBulk)\+ \ if you need to place multiple orders at the same time.\nBulk orders require\+ \ fewer risk checks in the trading engine and thus are ratelimited at **1/10**\+ \ the normal rate.\n\nYou can also improve your reactivity to market movements\+ \ while staying under your ratelimit by using the\n[Amend](#!/Order/Order_amend)\+ \ and [Amend Bulk](#!/Order/Order_amendBulk) endpoints. This allows you to\+ \ stay\nin the market and avoids the cancel/replace cycle.\n\n#### Tracking\+ \ Your Orders\n\nIf you want to keep track of order IDs yourself, set a unique\+ \ `clOrdID` per order.\nThis `clOrdID` will come back as a property on the\+ \ order and any related executions (including on the WebSocket),\nand can\+ \ be used to get or cancel the order. Max length is 36 characters.\n"+ operationId: "Order.new"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Instrument symbol. e.g. 'XBTUSD'."+ required: true+ type: "string"+ - name: "side"+ in: "formData"+ description: "Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless\+ \ `orderQty` or `simpleOrderQty` is negative."+ required: false+ type: "string"+ - name: "simpleOrderQty"+ in: "formData"+ description: "Order quantity in units of the underlying instrument (i.e. Bitcoin)."+ required: false+ type: "number"+ format: "double"+ - name: "quantity"+ in: "formData"+ description: "Deprecated: use `orderQty`."+ required: false+ type: "number"+ format: "int32"+ - name: "orderQty"+ in: "formData"+ description: "Order quantity in units of the instrument (i.e. contracts)."+ required: false+ type: "number"+ format: "int32"+ - name: "price"+ in: "formData"+ description: "Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched'\+ \ orders."+ required: false+ type: "number"+ format: "double"+ - name: "displayQty"+ in: "formData"+ description: "Optional quantity to display in the book. Use 0 for a fully\+ \ hidden order."+ required: false+ type: "number"+ format: "int32"+ - name: "stopPrice"+ in: "formData"+ description: "Deprecated: use `stopPx`."+ required: false+ type: "number"+ format: "double"+ - name: "stopPx"+ in: "formData"+ description: "Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched',\+ \ and 'LimitIfTouched' orders. Use a price below the current price for stop-sell\+ \ orders and buy-if-touched orders. Use `execInst` of 'MarkPrice' or 'LastPrice'\+ \ to define the current price used for triggering."+ required: false+ type: "number"+ format: "double"+ - name: "clOrdID"+ in: "formData"+ description: "Optional Client Order ID. This clOrdID will come back on the\+ \ order and any related executions."+ required: false+ type: "string"+ - name: "clOrdLinkID"+ in: "formData"+ description: "Optional Client Order Link ID for contingent orders."+ required: false+ type: "string"+ - name: "pegOffsetValue"+ in: "formData"+ description: "Optional trailing offset from the current price for 'Stop',\+ \ 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative\+ \ offset for stop-sell orders and buy-if-touched orders. Optional offset\+ \ from the peg price for 'Pegged' orders."+ required: false+ type: "number"+ format: "double"+ - name: "pegPriceType"+ in: "formData"+ description: "Optional peg price type. Valid options: LastPeg, MidPricePeg,\+ \ MarketPeg, PrimaryPeg, TrailingStopPeg."+ required: false+ type: "string"+ - name: "type"+ in: "formData"+ description: "Deprecated: use `ordType`."+ required: false+ type: "string"+ - name: "ordType"+ in: "formData"+ description: "Order type. Valid options: Market, Limit, Stop, StopLimit, MarketIfTouched,\+ \ LimitIfTouched, MarketWithLeftOverAsLimit, Pegged. Defaults to 'Limit'\+ \ when `price` is specified. Defaults to 'Stop' when `stopPx` is specified.\+ \ Defaults to 'StopLimit' when `price` and `stopPx` are specified."+ required: false+ type: "string"+ default: "Limit"+ - name: "timeInForce"+ in: "formData"+ description: "Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel,\+ \ FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', 'LimitIfTouched',\+ \ and 'MarketWithLeftOverAsLimit' orders."+ required: false+ type: "string"+ - name: "execInst"+ in: "formData"+ description: "Optional execution instructions. Valid options: ParticipateDoNotInitiate,\+ \ AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed.\+ \ 'AllOrNone' instruction requires `displayQty` to be 0. 'MarkPrice', 'IndexPrice'\+ \ or 'LastPrice' instruction valid for 'Stop', 'StopLimit', 'MarketIfTouched',\+ \ and 'LimitIfTouched' orders."+ required: false+ type: "string"+ - name: "contingencyType"+ in: "formData"+ description: "Optional contingency type for use with `clOrdLinkID`. Valid\+ \ options: OneCancelsTheOther, OneTriggersTheOther, OneUpdatesTheOtherAbsolute,\+ \ OneUpdatesTheOtherProportional."+ required: false+ type: "string"+ - name: "text"+ in: "formData"+ description: "Optional order annotation. e.g. 'Take profit'."+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ put:+ tags:+ - "Order"+ summary: "Amend the quantity or price of an open order."+ description: "Send an `orderID` or `origClOrdID` to identify the order you wish\+ \ to amend.\n\nBoth order quantity and price can be amended. Only one `qty`\+ \ field can be used to amend.\n\nUse the `leavesQty` field to specify how\+ \ much of the order you wish to remain open. This can be useful\nif you want\+ \ to adjust your position's delta by a certain amount, regardless of how much\+ \ of the order has\nalready filled.\n\nUse the `simpleOrderQty` and `simpleLeavesQty`\+ \ fields to specify order size in Bitcoin, rather than contracts.\nThese fields\+ \ will round up to the nearest contract.\n\nLike order placement, amending\+ \ can be done in bulk. Simply send a request to `PUT /api/v1/order/bulk` with\n\+ a JSON body of the shape: `{\"orders\": [{...}, {...}]}`, each object containing\+ \ the fields used in this endpoint.\n"+ operationId: "Order.amend"+ parameters:+ - name: "orderID"+ in: "formData"+ description: "Order ID"+ required: false+ type: "string"+ - name: "origClOrdID"+ in: "formData"+ description: "Client Order ID. See POST /order."+ required: false+ type: "string"+ - name: "clOrdID"+ in: "formData"+ description: "Optional new Client Order ID, requires `origClOrdID`."+ required: false+ type: "string"+ - name: "simpleOrderQty"+ in: "formData"+ description: "Optional order quantity in units of the underlying instrument\+ \ (i.e. Bitcoin)."+ required: false+ type: "number"+ format: "double"+ - name: "orderQty"+ in: "formData"+ description: "Optional order quantity in units of the instrument (i.e. contracts)."+ required: false+ type: "number"+ format: "int32"+ - name: "simpleLeavesQty"+ in: "formData"+ description: "Optional leaves quantity in units of the underlying instrument\+ \ (i.e. Bitcoin). Useful for amending partially filled orders."+ required: false+ type: "number"+ format: "double"+ - name: "leavesQty"+ in: "formData"+ description: "Optional leaves quantity in units of the instrument (i.e. contracts).\+ \ Useful for amending partially filled orders."+ required: false+ type: "number"+ format: "int32"+ - name: "price"+ in: "formData"+ description: "Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched'\+ \ orders."+ required: false+ type: "number"+ format: "double"+ - name: "stopPx"+ in: "formData"+ description: "Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched',\+ \ and 'LimitIfTouched' orders. Use a price below the current price for stop-sell\+ \ orders and buy-if-touched orders."+ required: false+ type: "number"+ format: "double"+ - name: "pegOffsetValue"+ in: "formData"+ description: "Optional trailing offset from the current price for 'Stop',\+ \ 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative\+ \ offset for stop-sell orders and buy-if-touched orders. Optional offset\+ \ from the peg price for 'Pegged' orders."+ required: false+ type: "number"+ format: "double"+ - name: "text"+ in: "formData"+ description: "Optional amend annotation. e.g. 'Adjust skew'."+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ delete:+ tags:+ - "Order"+ summary: "Cancel order(s). Send multiple order IDs to cancel in bulk."+ description: "Either an orderID or a clOrdID must be provided."+ operationId: "Order.cancel"+ parameters:+ - name: "orderID"+ in: "formData"+ description: "Order ID(s)."+ required: false+ type: "string"+ format: "JSON"+ - name: "clOrdID"+ in: "formData"+ description: "Client Order ID(s). See POST /order."+ required: false+ type: "string"+ format: "JSON"+ - name: "text"+ in: "formData"+ description: "Optional cancellation annotation. e.g. 'Spread Exceeded'."+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /order/bulk:+ post:+ tags:+ - "Order"+ summary: "Create multiple new orders for the same symbol."+ description: "This endpoint is used for placing bulk orders. Valid order types\+ \ are Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit,\+ \ and Pegged.\n\nEach individual order object in the array should have the\+ \ same properties as an individual POST /order call.\n\nThis endpoint is much\+ \ faster for getting many orders into the book at once. Because it reduces\+ \ load on BitMEX\nsystems, this endpoint is ratelimited at `ceil(0.1 * orders)`.\+ \ Submitting 10 orders via a bulk order call\nwill only count as 1 request,\+ \ 15 as 2, 32 as 4, and so on.\n\nFor now, only `application/json` is supported\+ \ on this endpoint.\n"+ operationId: "Order.newBulk"+ parameters:+ - name: "orders"+ in: "formData"+ description: "An array of orders."+ required: false+ type: "string"+ format: "JSON"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ put:+ tags:+ - "Order"+ summary: "Amend multiple orders for the same symbol."+ description: "Similar to POST /amend, but with multiple orders. `application/json`\+ \ only. Ratelimited at 50%."+ operationId: "Order.amendBulk"+ parameters:+ - name: "orders"+ in: "formData"+ description: "An array of orders."+ required: false+ type: "string"+ format: "JSON"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /order/closePosition:+ post:+ tags:+ - "Order"+ summary: "Close a position. [Deprecated, use POST /order with execInst: 'Close']"+ description: "If no `price` is specified, a market order will be submitted to\+ \ close the whole of your position. This will also close all other open orders\+ \ in this symbol."+ operationId: "Order.closePosition"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Symbol of position to close."+ required: true+ type: "string"+ - name: "price"+ in: "formData"+ description: "Optional limit price."+ required: false+ type: "number"+ format: "double"+ responses:+ 200:+ description: "Request was successful"+ schema:+ description: "Resulting close order."+ $ref: "#/definitions/Order"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /order/all:+ delete:+ tags:+ - "Order"+ summary: "Cancels all of your orders."+ operationId: "Order.cancelAll"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Optional symbol. If provided, only cancels orders for that symbol."+ required: false+ type: "string"+ - name: "filter"+ in: "formData"+ description: "Optional filter for cancellation. Use to only cancel some orders,\+ \ e.g. `{\"side\": \"Buy\"}`."+ required: false+ type: "string"+ format: "JSON"+ - name: "text"+ in: "formData"+ description: "Optional cancellation annotation. e.g. 'Spread Exceeded'"+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "object"+ properties: {}+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /order/cancelAllAfter:+ post:+ tags:+ - "Order"+ summary: "Automatically cancel all your orders after a specified timeout."+ description: "Useful as a dead-man's switch to ensure your orders are canceled\+ \ in case of an outage.\nIf called repeatedly, the existing offset will be\+ \ canceled and a new one will be inserted in its place.\n\nExample usage:\+ \ call this route at 15s intervals with an offset of 60000 (60s).\nIf this\+ \ route is not called within 60 seconds, all your orders will be automatically\+ \ canceled.\n\nThis is also available via [WebSocket](https://www.bitmex.com/app/wsAPI#dead-man-s-switch-auto-cancel-).\n"+ operationId: "Order.cancelAllAfter"+ parameters:+ - name: "timeout"+ in: "formData"+ description: "Timeout in ms. Set to 0 to cancel this timer. "+ required: true+ type: "number"+ format: "double"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "object"+ properties: {}+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /orderBook:+ get:+ tags:+ - "OrderBook"+ summary: "Get current orderbook [deprecated, use /orderBook/L2]."+ operationId: "OrderBook.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a series (e.g. XBT) to get data for\+ \ the nearest contract in that series."+ required: true+ type: "string"+ - name: "depth"+ in: "query"+ description: "Orderbook depth."+ required: false+ type: "number"+ default: 25+ minimum: 0+ format: "int32"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/OrderBook"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /orderBook/L2:+ get:+ tags:+ - "OrderBook"+ summary: "Get current orderbook in vertical format."+ operationId: "OrderBook.getL2"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a series (e.g. XBT) to get data for\+ \ the nearest contract in that series."+ required: true+ type: "string"+ - name: "depth"+ in: "query"+ description: "Orderbook depth per side. Send 0 for full depth."+ required: false+ type: "number"+ default: 25+ minimum: 0+ format: "int32"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/OrderBookL2"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /position:+ get:+ tags:+ - "Position"+ summary: "Get your positions."+ description: "See <a href=\"http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AP_6580.html\"\+ >the FIX Spec</a> for explanations of these fields."+ operationId: "Position.get"+ parameters:+ - name: "filter"+ in: "query"+ description: "Table filter. For example, send {\"symbol\": \"XBTUSD\"}."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Which columns to fetch. For example, send [\"columnName\"]."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of rows to fetch."+ required: false+ type: "number"+ format: "int32"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Position"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /position/isolate:+ post:+ tags:+ - "Position"+ summary: "Enable isolated margin or cross margin per-position."+ description: "Users can switch isolate margin per-position. This function allows\+ \ switching margin isolation (aka fixed margin) on and off."+ operationId: "Position.isolateMargin"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Position symbol to isolate."+ required: true+ type: "string"+ - name: "enabled"+ in: "formData"+ description: "True for isolated margin, false for cross margin."+ required: false+ type: "boolean"+ default: true+ responses:+ 200:+ description: "Request was successful"+ schema:+ description: "Affected position."+ $ref: "#/definitions/Position"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /position/riskLimit:+ post:+ tags:+ - "Position"+ summary: "Update your risk limit."+ description: "Risk Limits limit the size of positions you can trade at various\+ \ margin levels. Larger positions require more margin. Please see the Risk\+ \ Limit documentation for more details."+ operationId: "Position.updateRiskLimit"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Symbol of position to isolate."+ required: true+ type: "string"+ - name: "riskLimit"+ in: "formData"+ description: "New Risk Limit, in Satoshis."+ required: true+ type: "number"+ format: "int64"+ responses:+ 200:+ description: "Request was successful"+ schema:+ description: "Affected position."+ $ref: "#/definitions/Position"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /position/transferMargin:+ post:+ tags:+ - "Position"+ summary: "Transfer equity in or out of a position."+ description: "When margin is isolated on a position, use this function to add\+ \ or remove margin from the position. Note that you cannot remove margin below\+ \ the initial margin threshold."+ operationId: "Position.transferIsolatedMargin"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Symbol of position to isolate."+ required: true+ type: "string"+ - name: "amount"+ in: "formData"+ description: "Amount to transfer, in Satoshis. May be negative."+ required: true+ type: "number"+ format: "int64"+ responses:+ 200:+ description: "Request was successful"+ schema:+ description: "Affected position."+ $ref: "#/definitions/Position"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /position/leverage:+ post:+ tags:+ - "Position"+ summary: "Choose leverage for a position."+ description: "Users can choose an isolated leverage. This will automatically\+ \ enable isolated margin."+ operationId: "Position.updateLeverage"+ parameters:+ - name: "symbol"+ in: "formData"+ description: "Symbol of position to adjust."+ required: true+ type: "string"+ - name: "leverage"+ in: "formData"+ description: "Leverage value. Send a number between 0.01 and 100 to enable\+ \ isolated margin with a fixed leverage. Send 0 to enable cross margin."+ required: true+ type: "number"+ format: "double"+ responses:+ 200:+ description: "Request was successful"+ schema:+ description: "Affected position."+ $ref: "#/definitions/Position"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ /quote:+ get:+ tags:+ - "Quote"+ summary: "Get Quotes."+ operationId: "Quote.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Quote"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /quote/bucketed:+ get:+ tags:+ - "Quote"+ summary: "Get previous quotes in time buckets."+ operationId: "Quote.getBucketed"+ parameters:+ - name: "binSize"+ in: "query"+ description: "Time interval to bucket by. Available options: [1m,5m,1h,1d]."+ required: false+ type: "string"+ default: "1m"+ - name: "partial"+ in: "query"+ description: "If true, will send in-progress (incomplete) bins for the current\+ \ time period."+ required: false+ type: "boolean"+ default: false+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Quote"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /schema:+ get:+ tags:+ - "Schema"+ summary: "Get model schemata for data objects returned by this API."+ operationId: "Schema.get"+ parameters:+ - name: "model"+ in: "query"+ description: "Optional model filter. If omitted, will return all models."+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "object"+ properties: {}+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /schema/websocketHelp:+ get:+ tags:+ - "Schema"+ summary: "Returns help text & subject list for websocket usage."+ operationId: "Schema.websocketHelp"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "object"+ properties: {}+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /settlement:+ get:+ tags:+ - "Settlement"+ summary: "Get settlement history."+ operationId: "Settlement.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Settlement"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /stats:+ get:+ tags:+ - "Stats"+ summary: "Get exchange-wide and per-series turnover and volume statistics."+ operationId: "Stats.get"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Stats"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /stats/history:+ get:+ tags:+ - "Stats"+ summary: "Get historical exchange-wide and per-series turnover and volume statistics."+ operationId: "Stats.history"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/StatsHistory"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /stats/historyUSD:+ get:+ tags:+ - "Stats"+ summary: "Get a summary of exchange statistics in USD."+ operationId: "Stats.historyUSD"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/StatsUSD"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /trade:+ get:+ tags:+ - "Trade"+ summary: "Get Trades."+ description: "Please note that indices (symbols starting with `.`) post trades\+ \ at intervals to the trade feed. These have a `size` of 0 and are used only\+ \ to indicate a changing price.\n\nSee [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AE_6569.html)\+ \ for explanations of these fields."+ operationId: "Trade.get"+ parameters:+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Trade"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /trade/bucketed:+ get:+ tags:+ - "Trade"+ summary: "Get previous trades in time buckets."+ operationId: "Trade.getBucketed"+ parameters:+ - name: "binSize"+ in: "query"+ description: "Time interval to bucket by. Available options: [1m,5m,1h,1d]."+ required: false+ type: "string"+ default: "1m"+ - name: "partial"+ in: "query"+ description: "If true, will send in-progress (incomplete) bins for the current\+ \ time period."+ required: false+ type: "boolean"+ default: false+ - name: "symbol"+ in: "query"+ description: "Instrument symbol. Send a bare series (e.g. XBU) to get data\+ \ for the nearest expiring contract in that series.\n\nYou can also send\+ \ a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`,\+ \ `quarterly`, and `biquarterly`."+ required: false+ type: "string"+ - name: "filter"+ in: "query"+ description: "Generic table filter. Send JSON key/value pairs, such as `{\"\+ key\": \"value\"}`. You can key on individual fields, and do more advanced\+ \ querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters)\+ \ for more details."+ required: false+ type: "string"+ format: "JSON"+ - name: "columns"+ in: "query"+ description: "Array of column names to fetch. If omitted, will return all\+ \ columns.\n\nNote that this method will always return item keys, even when\+ \ not specified, so you may receive more columns that you expect."+ required: false+ type: "string"+ format: "JSON"+ - name: "count"+ in: "query"+ description: "Number of results to fetch."+ required: false+ type: "number"+ default: 100+ format: "int32"+ - name: "start"+ in: "query"+ description: "Starting point for results."+ required: false+ type: "number"+ default: 0+ format: "int32"+ - name: "reverse"+ in: "query"+ description: "If true, will sort results newest first."+ required: false+ type: "boolean"+ default: false+ - name: "startTime"+ in: "query"+ description: "Starting date filter for results."+ required: false+ type: "string"+ format: "date-time"+ - name: "endTime"+ in: "query"+ description: "Ending date filter for results."+ required: false+ type: "string"+ format: "date-time"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/TradeBin"+ 400:+ description: "Parameter Error"+ schema:+ $ref: "#/definitions/Error"+ 401:+ description: "Unauthorized"+ schema:+ $ref: "#/definitions/Error"+ 404:+ description: "Not Found"+ schema:+ $ref: "#/definitions/Error"+ security: []+ /user/depositAddress:+ get:+ tags:+ - "User"+ summary: "Get a deposit address."+ operationId: "User.getDepositAddress"+ parameters:+ - name: "currency"+ in: "query"+ required: false+ type: "string"+ default: "XBt"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "string"+ /user/wallet:+ get:+ tags:+ - "User"+ summary: "Get your current wallet information."+ operationId: "User.getWallet"+ parameters:+ - name: "currency"+ in: "query"+ required: false+ type: "string"+ default: "XBt"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Wallet"+ /user/walletHistory:+ get:+ tags:+ - "User"+ summary: "Get a history of all of your wallet transactions (deposits, withdrawals,\+ \ PNL)."+ operationId: "User.getWalletHistory"+ parameters:+ - name: "currency"+ in: "query"+ required: false+ type: "string"+ default: "XBt"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Transaction"+ /user/walletSummary:+ get:+ tags:+ - "User"+ summary: "Get a summary of all of your wallet transactions (deposits, withdrawals,\+ \ PNL)."+ operationId: "User.getWalletSummary"+ parameters:+ - name: "currency"+ in: "query"+ required: false+ type: "string"+ default: "XBt"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/Transaction"+ /user/minWithdrawalFee:+ get:+ tags:+ - "User"+ summary: "Get the minimum withdrawal fee for a currency."+ description: "This is changed based on network conditions to ensure timely withdrawals.\+ \ During network congestion, this may be high. The fee is returned in the\+ \ same currency."+ operationId: "User.minWithdrawalFee"+ parameters:+ - name: "currency"+ in: "query"+ required: false+ type: "string"+ default: "XBt"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "object"+ properties: {}+ security: []+ /user/requestWithdrawal:+ post:+ tags:+ - "User"+ summary: "Request a withdrawal to an external wallet."+ description: "This will send a confirmation email to the email address on record,\+ \ unless requested via an API Key with the `withdraw` permission."+ operationId: "User.requestWithdrawal"+ parameters:+ - name: "otpToken"+ in: "formData"+ description: "2FA token. Required if 2FA is enabled on your account."+ required: false+ type: "string"+ - name: "currency"+ in: "formData"+ description: "Currency you're withdrawing. Options: `XBt`"+ required: true+ type: "string"+ default: "XBt"+ - name: "amount"+ in: "formData"+ description: "Amount of withdrawal currency."+ required: true+ type: "number"+ format: "int64"+ - name: "address"+ in: "formData"+ description: "Destination Address."+ required: true+ type: "string"+ - name: "fee"+ in: "formData"+ description: "Network fee for Bitcoin withdrawals. If not specified, a default\+ \ value will be calculated based on Bitcoin network conditions. You will\+ \ have a chance to confirm this via email."+ required: false+ type: "number"+ format: "double"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Transaction"+ /user/cancelWithdrawal:+ post:+ tags:+ - "User"+ summary: "Cancel a withdrawal."+ operationId: "User.cancelWithdrawal"+ parameters:+ - name: "token"+ in: "formData"+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Transaction"+ security: []+ /user/confirmWithdrawal:+ post:+ tags:+ - "User"+ summary: "Confirm a withdrawal."+ operationId: "User.confirmWithdrawal"+ parameters:+ - name: "token"+ in: "formData"+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Transaction"+ security: []+ /user/requestEnableTFA:+ post:+ tags:+ - "User"+ summary: "Get secret key for setting up two-factor auth."+ description: "Use /confirmEnableTFA directly for Yubikeys. This fails if TFA\+ \ is already enabled."+ operationId: "User.requestEnableTFA"+ parameters:+ - name: "type"+ in: "formData"+ description: "Two-factor auth type. Supported types: 'GA' (Google Authenticator)"+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "boolean"+ /user/confirmEnableTFA:+ post:+ tags:+ - "User"+ summary: "Confirm two-factor auth for this account. If using a Yubikey, simply\+ \ send a token to this endpoint."+ operationId: "User.confirmEnableTFA"+ parameters:+ - name: "type"+ in: "formData"+ description: "Two-factor auth type. Supported types: 'GA' (Google Authenticator),\+ \ 'Yubikey'"+ required: false+ type: "string"+ - name: "token"+ in: "formData"+ description: "Token from your selected TFA type."+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "boolean"+ /user/disableTFA:+ post:+ tags:+ - "User"+ summary: "Disable two-factor auth for this account."+ operationId: "User.disableTFA"+ parameters:+ - name: "type"+ in: "formData"+ description: "Two-factor auth type. Supported types: 'GA' (Google Authenticator)"+ required: false+ type: "string"+ - name: "token"+ in: "formData"+ description: "Token from your selected TFA type."+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "boolean"+ /user/confirmEmail:+ post:+ tags:+ - "User"+ summary: "Confirm your email address with a token."+ operationId: "User.confirm"+ parameters:+ - name: "token"+ in: "formData"+ required: true+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/AccessToken"+ security: []+ /user/affiliateStatus:+ get:+ tags:+ - "User"+ summary: "Get your current affiliate/referral status."+ operationId: "User.getAffiliateStatus"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Affiliate"+ /user/checkReferralCode:+ get:+ tags:+ - "User"+ summary: "Check if a referral code is valid."+ description: "If the code is valid, responds with the referral code's discount\+ \ (e.g. `0.1` for 10%). Otherwise, will return a 404."+ operationId: "User.checkReferralCode"+ parameters:+ - name: "referralCode"+ in: "query"+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "number"+ format: "double"+ security: []+ /user/logout:+ post:+ tags:+ - "User"+ summary: "Log out of BitMEX."+ operationId: "User.logout"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ security: []+ /user/logoutAll:+ post:+ tags:+ - "User"+ summary: "Log all systems out of BitMEX. This will revoke all of your account's\+ \ access tokens, logging you out on all devices."+ operationId: "User.logoutAll"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "number"+ format: "double"+ /user/preferences:+ post:+ tags:+ - "User"+ summary: "Save user preferences."+ operationId: "User.savePreferences"+ parameters:+ - name: "prefs"+ in: "formData"+ required: true+ type: "string"+ format: "JSON"+ - name: "overwrite"+ in: "formData"+ description: "If true, will overwrite all existing preferences."+ required: false+ type: "boolean"+ default: false+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/User"+ /user:+ get:+ tags:+ - "User"+ summary: "Get your user model."+ operationId: "User.get"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/User"+ put:+ tags:+ - "User"+ summary: "Update your password, name, and other attributes."+ operationId: "User.update"+ parameters:+ - name: "firstname"+ in: "formData"+ required: false+ type: "string"+ - name: "lastname"+ in: "formData"+ required: false+ type: "string"+ - name: "oldPassword"+ in: "formData"+ required: false+ type: "string"+ - name: "newPassword"+ in: "formData"+ required: false+ type: "string"+ - name: "newPasswordConfirm"+ in: "formData"+ required: false+ type: "string"+ - name: "username"+ in: "formData"+ description: "Username can only be set once. To reset, email support."+ required: false+ type: "string"+ - name: "country"+ in: "formData"+ description: "Country of residence."+ required: false+ type: "string"+ - name: "pgpPubKey"+ in: "formData"+ description: "PGP Public Key. If specified, automated emails will be sentwith\+ \ this key."+ required: false+ type: "string"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/User"+ /user/commission:+ get:+ tags:+ - "User"+ summary: "Get your account's commission status."+ operationId: "User.getCommission"+ parameters: []+ responses:+ 200:+ description: "Request was successful"+ schema:+ type: "array"+ items:+ $ref: "#/definitions/UserCommission"+ /user/margin:+ get:+ tags:+ - "User"+ summary: "Get your account's margin status. Send a currency of \"all\" to receive\+ \ an array of all supported currencies."+ operationId: "User.getMargin"+ parameters:+ - name: "currency"+ in: "query"+ required: false+ type: "string"+ default: "XBt"+ responses:+ 200:+ description: "Request was successful"+ schema:+ $ref: "#/definitions/Margin"+securityDefinitions:+ apiKey:+ type: "apiKey"+ name: "api-key"+ in: "header"+ apiSignature:+ type: "apiKey"+ name: "api-signature"+ in: "header"+ apiNonce:+ type: "apiKey"+ name: "api-nonce"+ in: "header"+definitions:+ Announcement:+ type: "object"+ required:+ - "id"+ properties:+ id:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ link:+ type: "string"+ x-dataType: "Text"+ title:+ type: "string"+ x-dataType: "Text"+ content:+ type: "string"+ x-dataType: "Text"+ date:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ description: "Public Announcements"+ example:+ date: "2000-01-23T04:56:07.000+00:00"+ link: "link"+ id: 0.80082819046101150206595775671303272247314453125+ title: "title"+ content: "content"+ Error:+ type: "object"+ required:+ - "error"+ properties:+ error:+ $ref: "#/definitions/Error_error"+ x-dataType: "ErrorError"+ x-any:+ type: "object"+ APIKey:+ type: "object"+ required:+ - "id"+ - "name"+ - "nonce"+ - "secret"+ - "userId"+ properties:+ id:+ type: "string"+ maxLength: 24+ x-dataType: "Text"+ secret:+ type: "string"+ maxLength: 48+ x-dataType: "Text"+ name:+ type: "string"+ maxLength: 64+ x-dataType: "Text"+ nonce:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ cidr:+ type: "string"+ maxLength: 18+ x-dataType: "Text"+ permissions:+ type: "array"+ items:+ $ref: "#/definitions/x-any"+ x-dataType: "[XAny]"+ enabled:+ type: "boolean"+ default: false+ x-dataType: "Bool"+ userId:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ created:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ description: "Persistent API Keys for Developers"+ example:+ permissions:+ - {}+ - {}+ created: "2000-01-23T04:56:07.000+00:00"+ name: "name"+ cidr: "cidr"+ id: "id"+ secret: "secret"+ nonce: 0.80082819046101150206595775671303272247314453125+ userId: 6.02745618307040320615897144307382404804229736328125+ enabled: false+ Chat:+ type: "object"+ required:+ - "date"+ - "html"+ - "message"+ - "user"+ properties:+ id:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ date:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ user:+ type: "string"+ x-dataType: "Text"+ message:+ type: "string"+ x-dataType: "Text"+ html:+ type: "string"+ x-dataType: "Text"+ fromBot:+ type: "boolean"+ default: false+ x-dataType: "Bool"+ channelID:+ type: "number"+ format: "double"+ x-dataType: "Double"+ description: "Trollbox Data"+ example:+ date: "2000-01-23T04:56:07.000+00:00"+ html: "html"+ id: 0.80082819046101150206595775671303272247314453125+ message: "message"+ user: "user"+ channelID: 6.02745618307040320615897144307382404804229736328125+ fromBot: false+ ChatChannels:+ type: "object"+ required:+ - "name"+ properties:+ id:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ name:+ type: "string"+ x-dataType: "Text"+ example:+ name: "name"+ id: 0.80082819046101150206595775671303272247314453125+ ConnectedUsers:+ type: "object"+ properties:+ users:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ bots:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ example:+ bots: 6.02745618307040320615897144307382404804229736328125+ users: 0.80082819046101150206595775671303272247314453125+ Execution:+ type: "object"+ required:+ - "execID"+ properties:+ execID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ orderID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ clOrdID:+ type: "string"+ x-dataType: "Text"+ clOrdLinkID:+ type: "string"+ x-dataType: "Text"+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ symbol:+ type: "string"+ x-dataType: "Text"+ side:+ type: "string"+ x-dataType: "Text"+ lastQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ lastPx:+ type: "number"+ format: "double"+ x-dataType: "Double"+ underlyingLastPx:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lastMkt:+ type: "string"+ x-dataType: "Text"+ lastLiquidityInd:+ type: "string"+ x-dataType: "Text"+ simpleOrderQty:+ type: "number"+ format: "double"+ x-dataType: "Double"+ orderQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ price:+ type: "number"+ format: "double"+ x-dataType: "Double"+ displayQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ stopPx:+ type: "number"+ format: "double"+ x-dataType: "Double"+ pegOffsetValue:+ type: "number"+ format: "double"+ x-dataType: "Double"+ pegPriceType:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ settlCurrency:+ type: "string"+ x-dataType: "Text"+ execType:+ type: "string"+ x-dataType: "Text"+ ordType:+ type: "string"+ x-dataType: "Text"+ timeInForce:+ type: "string"+ x-dataType: "Text"+ execInst:+ type: "string"+ x-dataType: "Text"+ contingencyType:+ type: "string"+ x-dataType: "Text"+ exDestination:+ type: "string"+ x-dataType: "Text"+ ordStatus:+ type: "string"+ x-dataType: "Text"+ triggered:+ type: "string"+ x-dataType: "Text"+ workingIndicator:+ type: "boolean"+ x-dataType: "Bool"+ ordRejReason:+ type: "string"+ x-dataType: "Text"+ simpleLeavesQty:+ type: "number"+ format: "double"+ x-dataType: "Double"+ leavesQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ simpleCumQty:+ type: "number"+ format: "double"+ x-dataType: "Double"+ cumQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ avgPx:+ type: "number"+ format: "double"+ x-dataType: "Double"+ commission:+ type: "number"+ format: "double"+ x-dataType: "Double"+ tradePublishIndicator:+ type: "string"+ x-dataType: "Text"+ multiLegReportingType:+ type: "string"+ x-dataType: "Text"+ text:+ type: "string"+ x-dataType: "Text"+ trdMatchID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ execCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ homeNotional:+ type: "number"+ format: "double"+ x-dataType: "Double"+ foreignNotional:+ type: "number"+ format: "double"+ x-dataType: "Double"+ transactTime:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ description: "Raw Order and Balance Data"+ example:+ symbol: "symbol"+ triggered: "triggered"+ clOrdLinkID: "clOrdLinkID"+ execInst: "execInst"+ homeNotional: 4.9652184929849543237878606305457651615142822265625+ pegOffsetValue: 2.027123023002321833274663731572218239307403564453125+ pegPriceType: "pegPriceType"+ execID: "execID"+ contingencyType: "contingencyType"+ foreignNotional: 5.02500479152029466689555192715488374233245849609375+ lastMkt: "lastMkt"+ simpleCumQty: 1.231513536777255612975068288506008684635162353515625+ execCost: 7.4577447736837658709418974467553198337554931640625+ execComm: 1.173074250955943309548956676735542714595794677734375+ settlCurrency: "settlCurrency"+ ordRejReason: "ordRejReason"+ price: 7.061401241503109105224211816675961017608642578125+ trdMatchID: "trdMatchID"+ orderQty: 2.3021358869347654518833223846741020679473876953125+ currency: "currency"+ commission: 6.8468526983526398765889098285697400569915771484375+ text: "text"+ execType: "execType"+ timeInForce: "timeInForce"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ ordStatus: "ordStatus"+ side: "side"+ simpleOrderQty: 5.63737665663332876420099637471139430999755859375+ orderID: "orderID"+ lastPx: 1.46581298050294517310021547018550336360931396484375+ leavesQty: 7.3862819483858839220147274318151175975799560546875+ cumQty: 1.024645700144157789424070870154537260532379150390625+ tradePublishIndicator: "tradePublishIndicator"+ displayQty: 9.301444243932575517419536481611430644989013671875+ simpleLeavesQty: 4.1456080298839363962315474054776132106781005859375+ clOrdID: "clOrdID"+ lastQty: 6.02745618307040320615897144307382404804229736328125+ avgPx: 1.489415909854170383397331534069962799549102783203125+ multiLegReportingType: "multiLegReportingType"+ workingIndicator: true+ lastLiquidityInd: "lastLiquidityInd"+ transactTime: "2000-01-23T04:56:07.000+00:00"+ exDestination: "exDestination"+ account: 0.80082819046101150206595775671303272247314453125+ underlyingLastPx: 5.962133916683182377482808078639209270477294921875+ stopPx: 3.61607674925191080461672754609026014804840087890625+ ordType: "ordType"+ Funding:+ type: "object"+ required:+ - "symbol"+ - "timestamp"+ properties:+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ symbol:+ type: "string"+ x-dataType: "Text"+ fundingInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ fundingRate:+ type: "number"+ format: "double"+ x-dataType: "Double"+ fundingRateDaily:+ type: "number"+ format: "double"+ x-dataType: "Double"+ description: "Swap Funding History"+ example:+ symbol: "symbol"+ fundingRateDaily: 6.02745618307040320615897144307382404804229736328125+ fundingInterval: "2000-01-23T04:56:07.000+00:00"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ fundingRate: 0.80082819046101150206595775671303272247314453125+ Instrument:+ type: "object"+ required:+ - "symbol"+ properties:+ symbol:+ type: "string"+ x-dataType: "Text"+ rootSymbol:+ type: "string"+ x-dataType: "Text"+ state:+ type: "string"+ x-dataType: "Text"+ typ:+ type: "string"+ x-dataType: "Text"+ listing:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ front:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ expiry:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ settle:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ relistInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ inverseLeg:+ type: "string"+ x-dataType: "Text"+ sellLeg:+ type: "string"+ x-dataType: "Text"+ buyLeg:+ type: "string"+ x-dataType: "Text"+ positionCurrency:+ type: "string"+ x-dataType: "Text"+ underlying:+ type: "string"+ x-dataType: "Text"+ quoteCurrency:+ type: "string"+ x-dataType: "Text"+ underlyingSymbol:+ type: "string"+ x-dataType: "Text"+ reference:+ type: "string"+ x-dataType: "Text"+ referenceSymbol:+ type: "string"+ x-dataType: "Text"+ calcInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ publishInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ publishTime:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ maxOrderQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ maxPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lotSize:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ tickSize:+ type: "number"+ format: "double"+ x-dataType: "Double"+ multiplier:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ settlCurrency:+ type: "string"+ x-dataType: "Text"+ underlyingToPositionMultiplier:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ underlyingToSettleMultiplier:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ quoteToSettleMultiplier:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ isQuanto:+ type: "boolean"+ x-dataType: "Bool"+ isInverse:+ type: "boolean"+ x-dataType: "Bool"+ initMargin:+ type: "number"+ format: "double"+ x-dataType: "Double"+ maintMargin:+ type: "number"+ format: "double"+ x-dataType: "Double"+ riskLimit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ riskStep:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ limit:+ type: "number"+ format: "double"+ x-dataType: "Double"+ capped:+ type: "boolean"+ x-dataType: "Bool"+ taxed:+ type: "boolean"+ x-dataType: "Bool"+ deleverage:+ type: "boolean"+ x-dataType: "Bool"+ makerFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ takerFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ settlementFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ insuranceFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ fundingBaseSymbol:+ type: "string"+ x-dataType: "Text"+ fundingQuoteSymbol:+ type: "string"+ x-dataType: "Text"+ fundingPremiumSymbol:+ type: "string"+ x-dataType: "Text"+ fundingTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ fundingInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ fundingRate:+ type: "number"+ format: "double"+ x-dataType: "Double"+ indicativeFundingRate:+ type: "number"+ format: "double"+ x-dataType: "Double"+ rebalanceTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ rebalanceInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ openingTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ closingTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ sessionInterval:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ prevClosePrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ limitDownPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ limitUpPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ bankruptLimitDownPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ bankruptLimitUpPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ prevTotalVolume:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ totalVolume:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ volume:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ volume24h:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevTotalTurnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ totalTurnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover24h:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevPrice24h:+ type: "number"+ format: "double"+ x-dataType: "Double"+ vwap:+ type: "number"+ format: "double"+ x-dataType: "Double"+ highPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lowPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lastPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lastPriceProtected:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lastTickDirection:+ type: "string"+ x-dataType: "Text"+ lastChangePcnt:+ type: "number"+ format: "double"+ x-dataType: "Double"+ bidPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ midPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ askPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ impactBidPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ impactMidPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ impactAskPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ hasLiquidity:+ type: "boolean"+ x-dataType: "Bool"+ openInterest:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ fairMethod:+ type: "string"+ x-dataType: "Text"+ fairBasisRate:+ type: "number"+ format: "double"+ x-dataType: "Double"+ fairBasis:+ type: "number"+ format: "double"+ x-dataType: "Double"+ fairPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ markMethod:+ type: "string"+ x-dataType: "Text"+ markPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ indicativeTaxRate:+ type: "number"+ format: "double"+ x-dataType: "Double"+ indicativeSettlePrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ settledPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ description: "Tradeable Contracts, Indices, and History"+ example:+ totalVolume: 6.438423552598546706349225132726132869720458984375+ symbol: "symbol"+ capped: true+ vwap: 6.70401929795003592715829654480330646038055419921875+ closingTimestamp: "2000-01-23T04:56:07.000+00:00"+ typ: "typ"+ inverseLeg: "inverseLeg"+ reference: "reference"+ deleverage: true+ prevTotalTurnover: 1.2846590061165319429647979632136411964893341064453125+ riskLimit: 4.1456080298839363962315474054776132106781005859375+ fundingBaseSymbol: "fundingBaseSymbol"+ prevPrice24h: 5.94489560761401580890606055618263781070709228515625+ limit: 1.231513536777255612975068288506008684635162353515625+ highPrice: 3.35319334701124294184637619764544069766998291015625+ fairMethod: "fairMethod"+ taxed: true+ state: "state"+ expiry: "2000-01-23T04:56:07.000+00:00"+ fundingPremiumSymbol: "fundingPremiumSymbol"+ publishInterval: "2000-01-23T04:56:07.000+00:00"+ calcInterval: "2000-01-23T04:56:07.000+00:00"+ lastChangePcnt: 7.05877035158235610623478351044468581676483154296875+ publishTime: "2000-01-23T04:56:07.000+00:00"+ askPrice: 4.6523964329332461176136348512955009937286376953125+ maintMargin: 2.027123023002321833274663731572218239307403564453125+ takerFee: 1.489415909854170383397331534069962799549102783203125+ multiplier: 5.63737665663332876420099637471139430999755859375+ fairBasis: 3.258856561904760695824734284542500972747802734375+ volume24h: 6.96511769763884558415156789124011993408203125+ indicativeTaxRate: 6.6284642750877420525057459599338471889495849609375+ settlementFee: 6.8468526983526398765889098285697400569915771484375+ totalTurnover: 2.884162126668780246063761296682059764862060546875+ turnover24h: 6.87805222012787620400331434211693704128265380859375+ underlying: "underlying"+ quoteToSettleMultiplier: 9.301444243932575517419536481611430644989013671875+ fairPrice: 4.078845849666752343409825698472559452056884765625+ bidPrice: 6.51918095101838179772357761976309120655059814453125+ fundingQuoteSymbol: "fundingQuoteSymbol"+ quoteCurrency: "quoteCurrency"+ volume: 3.557195227068097320710649000830017030239105224609375+ impactMidPrice: 7.7403518187411730622216055053286254405975341796875+ indicativeSettlePrice: 4.258773108174356281097061582840979099273681640625+ sellLeg: "sellLeg"+ settledPrice: 1.0414449161182959269211778519093059003353118896484375+ relistInterval: "2000-01-23T04:56:07.000+00:00"+ maxOrderQty: 0.80082819046101150206595775671303272247314453125+ prevClosePrice: 5.02500479152029466689555192715488374233245849609375+ maxPrice: 6.02745618307040320615897144307382404804229736328125+ underlyingToPositionMultiplier: 2.3021358869347654518833223846741020679473876953125+ hasLiquidity: true+ openInterest: 3.05761002410493443193217899533919990062713623046875+ riskStep: 7.3862819483858839220147274318151175975799560546875+ settle: "2000-01-23T04:56:07.000+00:00"+ isQuanto: true+ buyLeg: "buyLeg"+ rootSymbol: "rootSymbol"+ tickSize: 5.962133916683182377482808078639209270477294921875+ markMethod: "markMethod"+ markPrice: 0.202532411323639305322785730822943150997161865234375+ underlyingSymbol: "underlyingSymbol"+ fundingTimestamp: "2000-01-23T04:56:07.000+00:00"+ settlCurrency: "settlCurrency"+ makerFee: 1.024645700144157789424070870154537260532379150390625+ lowPrice: 3.093745262666447448651751983561553061008453369140625+ underlyingToSettleMultiplier: 7.061401241503109105224211816675961017608642578125+ sessionInterval: "2000-01-23T04:56:07.000+00:00"+ fundingInterval: "2000-01-23T04:56:07.000+00:00"+ listing: "2000-01-23T04:56:07.000+00:00"+ indicativeFundingRate: 4.9652184929849543237878606305457651615142822265625+ bankruptLimitDownPrice: 6.683562403749608193948006373830139636993408203125+ turnover: 6.77832496304801335185175048536621034145355224609375+ positionCurrency: "positionCurrency"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ impactAskPrice: 3.02057969929162428712743349024094641208648681640625+ referenceSymbol: "referenceSymbol"+ limitDownPrice: 9.965781217890562260208753286860883235931396484375+ lastTickDirection: "lastTickDirection"+ openValue: 7.04836565559697003635619694250635802745819091796875+ isInverse: true+ lotSize: 1.46581298050294517310021547018550336360931396484375+ rebalanceTimestamp: "2000-01-23T04:56:07.000+00:00"+ openingTimestamp: "2000-01-23T04:56:07.000+00:00"+ fairBasisRate: 5.5332583970349862312332334113307297229766845703125+ lastPriceProtected: 0.885137473901165261480628032586537301540374755859375+ midPrice: 0.10263654006109401706225980888120830059051513671875+ insuranceFee: 7.4577447736837658709418974467553198337554931640625+ impactBidPrice: 8.9695787981969115065794539987109601497650146484375+ prevTotalVolume: 9.0183481860707832566959041287191212177276611328125+ initMargin: 3.61607674925191080461672754609026014804840087890625+ limitUpPrice: 9.3693102714106686335071572102606296539306640625+ bankruptLimitUpPrice: 8.7620420127490010742121739895083010196685791015625+ front: "2000-01-23T04:56:07.000+00:00"+ rebalanceInterval: "2000-01-23T04:56:07.000+00:00"+ fundingRate: 1.173074250955943309548956676735542714595794677734375+ lastPrice: 7.14353804701230643559028976596891880035400390625+ InstrumentInterval:+ type: "object"+ required:+ - "intervals"+ - "symbols"+ properties:+ intervals:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ symbols:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ example:+ intervals:+ - "intervals"+ - "intervals"+ symbols:+ - "symbols"+ - "symbols"+ IndexComposite:+ type: "object"+ required:+ - "timestamp"+ properties:+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ symbol:+ type: "string"+ x-dataType: "Text"+ indexSymbol:+ type: "string"+ x-dataType: "Text"+ reference:+ type: "string"+ x-dataType: "Text"+ lastPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ weight:+ type: "number"+ format: "double"+ x-dataType: "Double"+ logged:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ example:+ reference: "reference"+ symbol: "symbol"+ indexSymbol: "indexSymbol"+ logged: "2000-01-23T04:56:07.000+00:00"+ weight: 6.02745618307040320615897144307382404804229736328125+ timestamp: "2000-01-23T04:56:07.000+00:00"+ lastPrice: 0.80082819046101150206595775671303272247314453125+ Insurance:+ type: "object"+ required:+ - "currency"+ - "timestamp"+ properties:+ currency:+ type: "string"+ x-dataType: "Text"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ walletBalance:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ description: "Insurance Fund Data"+ example:+ walletBalance: 0.80082819046101150206595775671303272247314453125+ currency: "currency"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ Leaderboard:+ type: "object"+ required:+ - "name"+ properties:+ name:+ type: "string"+ x-dataType: "Text"+ isRealName:+ type: "boolean"+ x-dataType: "Bool"+ isMe:+ type: "boolean"+ x-dataType: "Bool"+ profit:+ type: "number"+ format: "double"+ x-dataType: "Double"+ description: "Information on Top Users"+ example:+ isMe: true+ name: "name"+ isRealName: true+ profit: 0.80082819046101150206595775671303272247314453125+ Liquidation:+ type: "object"+ required:+ - "orderID"+ properties:+ orderID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ symbol:+ type: "string"+ x-dataType: "Text"+ side:+ type: "string"+ x-dataType: "Text"+ price:+ type: "number"+ format: "double"+ x-dataType: "Double"+ leavesQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ description: "Active Liquidations"+ example:+ symbol: "symbol"+ side: "side"+ orderID: "orderID"+ price: 0.80082819046101150206595775671303272247314453125+ leavesQty: 6.02745618307040320615897144307382404804229736328125+ Notification:+ type: "object"+ required:+ - "body"+ - "date"+ - "title"+ - "ttl"+ properties:+ id:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ date:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ title:+ type: "string"+ x-dataType: "Text"+ body:+ type: "string"+ x-dataType: "Text"+ ttl:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ type:+ type: "string"+ enum:+ - "success"+ - "error"+ - "info"+ x-dataType: "E'Type"+ closable:+ type: "boolean"+ default: true+ x-dataType: "Bool"+ persist:+ type: "boolean"+ default: true+ x-dataType: "Bool"+ waitForVisibility:+ type: "boolean"+ default: true+ x-dataType: "Bool"+ sound:+ type: "string"+ x-dataType: "Text"+ description: "Account Notifications"+ example:+ date: "2000-01-23T04:56:07.000+00:00"+ waitForVisibility: true+ closable: true+ sound: "sound"+ id: 0.80082819046101150206595775671303272247314453125+ persist: true+ title: "title"+ body: "body"+ type: "success"+ ttl: 6.02745618307040320615897144307382404804229736328125+ Order:+ type: "object"+ required:+ - "orderID"+ properties:+ orderID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ clOrdID:+ type: "string"+ x-dataType: "Text"+ clOrdLinkID:+ type: "string"+ x-dataType: "Text"+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ symbol:+ type: "string"+ x-dataType: "Text"+ side:+ type: "string"+ x-dataType: "Text"+ simpleOrderQty:+ type: "number"+ format: "double"+ x-dataType: "Double"+ orderQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ price:+ type: "number"+ format: "double"+ x-dataType: "Double"+ displayQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ stopPx:+ type: "number"+ format: "double"+ x-dataType: "Double"+ pegOffsetValue:+ type: "number"+ format: "double"+ x-dataType: "Double"+ pegPriceType:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ settlCurrency:+ type: "string"+ x-dataType: "Text"+ ordType:+ type: "string"+ x-dataType: "Text"+ timeInForce:+ type: "string"+ x-dataType: "Text"+ execInst:+ type: "string"+ x-dataType: "Text"+ contingencyType:+ type: "string"+ x-dataType: "Text"+ exDestination:+ type: "string"+ x-dataType: "Text"+ ordStatus:+ type: "string"+ x-dataType: "Text"+ triggered:+ type: "string"+ x-dataType: "Text"+ workingIndicator:+ type: "boolean"+ x-dataType: "Bool"+ ordRejReason:+ type: "string"+ x-dataType: "Text"+ simpleLeavesQty:+ type: "number"+ format: "double"+ x-dataType: "Double"+ leavesQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ simpleCumQty:+ type: "number"+ format: "double"+ x-dataType: "Double"+ cumQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ avgPx:+ type: "number"+ format: "double"+ x-dataType: "Double"+ multiLegReportingType:+ type: "string"+ x-dataType: "Text"+ text:+ type: "string"+ x-dataType: "Text"+ transactTime:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ description: "Placement, Cancellation, Amending, and History"+ example:+ symbol: "symbol"+ triggered: "triggered"+ clOrdLinkID: "clOrdLinkID"+ execInst: "execInst"+ pegOffsetValue: 7.061401241503109105224211816675961017608642578125+ pegPriceType: "pegPriceType"+ contingencyType: "contingencyType"+ simpleCumQty: 2.027123023002321833274663731572218239307403564453125+ settlCurrency: "settlCurrency"+ ordRejReason: "ordRejReason"+ price: 5.962133916683182377482808078639209270477294921875+ orderQty: 1.46581298050294517310021547018550336360931396484375+ currency: "currency"+ text: "text"+ timeInForce: "timeInForce"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ ordStatus: "ordStatus"+ side: "side"+ simpleOrderQty: 6.02745618307040320615897144307382404804229736328125+ orderID: "orderID"+ leavesQty: 3.61607674925191080461672754609026014804840087890625+ cumQty: 4.1456080298839363962315474054776132106781005859375+ displayQty: 5.63737665663332876420099637471139430999755859375+ simpleLeavesQty: 9.301444243932575517419536481611430644989013671875+ clOrdID: "clOrdID"+ avgPx: 7.3862819483858839220147274318151175975799560546875+ multiLegReportingType: "multiLegReportingType"+ workingIndicator: true+ transactTime: "2000-01-23T04:56:07.000+00:00"+ exDestination: "exDestination"+ account: 0.80082819046101150206595775671303272247314453125+ stopPx: 2.3021358869347654518833223846741020679473876953125+ ordType: "ordType"+ OrderBook:+ type: "object"+ required:+ - "level"+ - "symbol"+ properties:+ symbol:+ type: "string"+ x-dataType: "Text"+ level:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ bidSize:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ bidPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ askPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ askSize:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ description: "Level 2 Book Data"+ example:+ symbol: "symbol"+ askPrice: 5.962133916683182377482808078639209270477294921875+ level: 0.80082819046101150206595775671303272247314453125+ bidSize: 6.02745618307040320615897144307382404804229736328125+ bidPrice: 1.46581298050294517310021547018550336360931396484375+ askSize: 5.63737665663332876420099637471139430999755859375+ timestamp: "2000-01-23T04:56:07.000+00:00"+ OrderBookL2:+ type: "object"+ required:+ - "id"+ - "side"+ - "symbol"+ properties:+ symbol:+ type: "string"+ x-dataType: "Text"+ id:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ side:+ type: "string"+ x-dataType: "Text"+ size:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ price:+ type: "number"+ format: "double"+ x-dataType: "Double"+ example:+ symbol: "symbol"+ side: "side"+ size: 6.02745618307040320615897144307382404804229736328125+ price: 1.46581298050294517310021547018550336360931396484375+ id: 0.80082819046101150206595775671303272247314453125+ Position:+ type: "object"+ required:+ - "account"+ - "currency"+ - "symbol"+ properties:+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ symbol:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ underlying:+ type: "string"+ x-dataType: "Text"+ quoteCurrency:+ type: "string"+ x-dataType: "Text"+ commission:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ initMarginReq:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ maintMarginReq:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ riskLimit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ leverage:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ crossMargin:+ type: "boolean"+ x-dataType: "Bool"+ deleveragePercentile:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ rebalancedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevRealisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevUnrealisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevClosePrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ openingTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ openingQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openingCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openingComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openOrderBuyQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openOrderBuyCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openOrderBuyPremium:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openOrderSellQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openOrderSellCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openOrderSellPremium:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execBuyQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execBuyCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execSellQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execSellCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currentTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ currentQty:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currentCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currentComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ realisedCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossOpenCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossOpenPremium:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossExecCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ isOpen:+ type: "boolean"+ x-dataType: "Bool"+ markPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ markValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ riskValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ homeNotional:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ foreignNotional:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ posState:+ type: "string"+ x-dataType: "Text"+ posCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posCost2:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posCross:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posInit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posLoss:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posMaint:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ posAllowance:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ taxableMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ initMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ maintMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ sessionMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ targetExcessMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ varMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ realisedGrossPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ realisedTax:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ realisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedGrossPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ longBankrupt:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ shortBankrupt:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ taxBase:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ indicativeTaxRate:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ indicativeTax:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedTax:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedPnlPcnt:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ unrealisedRoePcnt:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ simpleQty:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ simpleCost:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ simpleValue:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ simplePnl:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ simplePnlPcnt:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ avgCostPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ avgEntryPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ breakEvenPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ marginCallPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ liquidationPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ bankruptPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ lastPrice:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ lastValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ description: "Summary of Open and Closed Positions"+ example:+ symbol: "symbol"+ lastValue: 5.2991435602753593769875806174241006374359130859375+ breakEvenPrice: 1.826870217705811594299802891327999532222747802734375+ avgCostPrice: 8.863729185622826634016746538691222667694091796875+ posLoss: 3.05761002410493443193217899533919990062713623046875+ openOrderSellQty: 1.173074250955943309548956676735542714595794677734375+ avgEntryPrice: 9.2541839462678385785920909256674349308013916015625+ taxBase: 5.5073869641798811613853104063309729099273681640625+ foreignNotional: 6.51918095101838179772357761976309120655059814453125+ execComm: 3.557195227068097320710649000830017030239105224609375+ riskLimit: 5.63737665663332876420099637471139430999755859375+ prevUnrealisedPnl: 2.027123023002321833274663731572218239307403564453125+ longBankrupt: 0.519900201872498524124921459588222205638885498046875+ marginCallPrice: 3.502657762086400783374529055436141788959503173828125+ unrealisedCost: 6.87805222012787620400331434211693704128265380859375+ posComm: 3.02057969929162428712743349024094641208648681640625+ posMaint: 5.5332583970349862312332334113307297229766845703125+ simplePnlPcnt: 4.57393626423225096999658489949069917201995849609375+ execSellCost: 8.7620420127490010742121739895083010196685791015625+ realisedCost: 6.77832496304801335185175048536621034145355224609375+ posInit: 7.7403518187411730622216055053286254405975341796875+ grossExecCost: 3.35319334701124294184637619764544069766998291015625+ posAllowance: 3.258856561904760695824734284542500972747802734375+ targetExcessMargin: 1.0414449161182959269211778519093059003353118896484375+ shortBankrupt: 7.93350688173715123951978966942988336086273193359375+ indicativeTax: 6.07389808578115175663469926803372800350189208984375+ maintMargin: 6.6284642750877420525057459599338471889495849609375+ riskValue: 0.885137473901165261480628032586537301540374755859375+ execBuyCost: 9.3693102714106686335071572102606296539306640625+ grossOpenPremium: 6.70401929795003592715829654480330646038055419921875+ currentCost: 1.2846590061165319429647979632136411964893341064453125+ indicativeTaxRate: 4.863159081028840091676102019846439361572265625+ underlying: "underlying"+ quoteCurrency: "quoteCurrency"+ initMarginReq: 1.46581298050294517310021547018550336360931396484375+ isOpen: true+ posCross: 8.9695787981969115065794539987109601497650146484375+ currentTimestamp: "2000-01-23T04:56:07.000+00:00"+ simpleValue: 8.289659398142969592981899040751159191131591796875+ prevClosePrice: 4.1456080298839363962315474054776132106781005859375+ unrealisedPnlPcnt: 3.901545264248647004734493748401291668415069580078125+ simpleCost: 1.7325933120207193116613098027301020920276641845703125+ execQty: 9.0183481860707832566959041287191212177276611328125+ taxableMargin: 4.078845849666752343409825698472559452056884765625+ openingCost: 1.231513536777255612975068288506008684635162353515625+ realisedGrossPnl: 7.26052126480210358039357743109576404094696044921875+ leverage: 2.3021358869347654518833223846741020679473876953125+ posState: "posState"+ openOrderSellPremium: 5.02500479152029466689555192715488374233245849609375+ simpleQty: 2.940964297482789646664969041012227535247802734375+ openingQty: 7.3862819483858839220147274318151175975799560546875+ homeNotional: 7.05877035158235610623478351044468581676483154296875+ liquidationPrice: 9.1831235947739937586220548837445676326751708984375+ openOrderBuyQty: 1.489415909854170383397331534069962799549102783203125+ unrealisedPnl: 4.4596050349586793259959449642337858676910400390625+ execCost: 6.438423552598546706349225132726132869720458984375+ unrealisedGrossPnl: 9.7029638000235660655334868351928889751434326171875+ markPrice: 3.093745262666447448651751983561553061008453369140625+ posMargin: 7.04836565559697003635619694250635802745819091796875+ unrealisedTax: 8.2516257489237574418439180590212345123291015625+ crossMargin: true+ deleveragePercentile: 7.061401241503109105224211816675961017608642578125+ openOrderBuyCost: 6.8468526983526398765889098285697400569915771484375+ posCost: 0.10263654006109401706225980888120830059051513671875+ currency: "currency"+ commission: 6.02745618307040320615897144307382404804229736328125+ sessionMargin: 4.258773108174356281097061582840979099273681640625+ maintMarginReq: 5.962133916683182377482808078639209270477294921875+ bankruptPrice: 8.761432466225475224064211943186819553375244140625+ openOrderSellCost: 4.9652184929849543237878606305457651615142822265625+ markValue: 7.14353804701230643559028976596891880035400390625+ timestamp: "2000-01-23T04:56:07.000+00:00"+ realisedPnl: 0.8774076871421565559927557842456735670566558837890625+ varMargin: 4.67894798900584873990737833082675933837890625+ realisedTax: 9.132027271330688478201409452594816684722900390625+ rebalancedPnl: 9.301444243932575517419536481611430644989013671875+ openOrderBuyPremium: 7.4577447736837658709418974467553198337554931640625+ posCost2: 4.6523964329332461176136348512955009937286376953125+ openingTimestamp: "2000-01-23T04:56:07.000+00:00"+ currentQty: 6.96511769763884558415156789124011993408203125+ currentComm: 2.884162126668780246063761296682059764862060546875+ execSellQty: 6.683562403749608193948006373830139636993408203125+ grossOpenCost: 5.94489560761401580890606055618263781070709228515625+ prevRealisedPnl: 3.61607674925191080461672754609026014804840087890625+ execBuyQty: 9.965781217890562260208753286860883235931396484375+ initMargin: 0.202532411323639305322785730822943150997161865234375+ unrealisedRoePcnt: 0.434313988241488146968549699522554874420166015625+ simplePnl: 6.623518433804886029747649445198476314544677734375+ account: 0.80082819046101150206595775671303272247314453125+ openingComm: 1.024645700144157789424070870154537260532379150390625+ lastPrice: 0.4182561061793121925944660688401199877262115478515625+ Quote:+ type: "object"+ required:+ - "symbol"+ - "timestamp"+ properties:+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ symbol:+ type: "string"+ x-dataType: "Text"+ bidSize:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ bidPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ askPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ askSize:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ description: "Best Bid/Offer Snapshots & Historical Bins"+ example:+ symbol: "symbol"+ askPrice: 1.46581298050294517310021547018550336360931396484375+ bidSize: 0.80082819046101150206595775671303272247314453125+ bidPrice: 6.02745618307040320615897144307382404804229736328125+ askSize: 5.962133916683182377482808078639209270477294921875+ timestamp: "2000-01-23T04:56:07.000+00:00"+ Settlement:+ type: "object"+ required:+ - "symbol"+ - "timestamp"+ properties:+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ symbol:+ type: "string"+ x-dataType: "Text"+ settlementType:+ type: "string"+ x-dataType: "Text"+ settledPrice:+ type: "number"+ format: "double"+ x-dataType: "Double"+ bankrupt:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ taxBase:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ taxRate:+ type: "number"+ format: "double"+ x-dataType: "Double"+ description: "Historical Settlement Data"+ example:+ settlementType: "settlementType"+ symbol: "symbol"+ taxRate: 5.962133916683182377482808078639209270477294921875+ settledPrice: 0.80082819046101150206595775671303272247314453125+ bankrupt: 6.02745618307040320615897144307382404804229736328125+ timestamp: "2000-01-23T04:56:07.000+00:00"+ taxBase: 1.46581298050294517310021547018550336360931396484375+ Stats:+ type: "object"+ required:+ - "rootSymbol"+ properties:+ rootSymbol:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ volume24h:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover24h:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openInterest:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ openValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ description: "Exchange Statistics"+ example:+ openInterest: 1.46581298050294517310021547018550336360931396484375+ openValue: 5.962133916683182377482808078639209270477294921875+ volume24h: 0.80082819046101150206595775671303272247314453125+ currency: "currency"+ turnover24h: 6.02745618307040320615897144307382404804229736328125+ rootSymbol: "rootSymbol"+ StatsHistory:+ type: "object"+ required:+ - "date"+ - "rootSymbol"+ properties:+ date:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ rootSymbol:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ volume:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ example:+ date: "2000-01-23T04:56:07.000+00:00"+ volume: 0.80082819046101150206595775671303272247314453125+ currency: "currency"+ turnover: 6.02745618307040320615897144307382404804229736328125+ rootSymbol: "rootSymbol"+ StatsUSD:+ type: "object"+ required:+ - "rootSymbol"+ properties:+ rootSymbol:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ turnover24h:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover30d:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover365d:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ example:+ turnover30d: 6.02745618307040320615897144307382404804229736328125+ turnover365d: 1.46581298050294517310021547018550336360931396484375+ currency: "currency"+ turnover24h: 0.80082819046101150206595775671303272247314453125+ turnover: 5.962133916683182377482808078639209270477294921875+ rootSymbol: "rootSymbol"+ Trade:+ type: "object"+ required:+ - "symbol"+ - "timestamp"+ properties:+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ symbol:+ type: "string"+ x-dataType: "Text"+ side:+ type: "string"+ x-dataType: "Text"+ size:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ price:+ type: "number"+ format: "double"+ x-dataType: "Double"+ tickDirection:+ type: "string"+ x-dataType: "Text"+ trdMatchID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ grossValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ homeNotional:+ type: "number"+ format: "double"+ x-dataType: "Double"+ foreignNotional:+ type: "number"+ format: "double"+ x-dataType: "Double"+ description: "Individual & Bucketed Trades"+ example:+ foreignNotional: 5.63737665663332876420099637471139430999755859375+ symbol: "symbol"+ side: "side"+ tickDirection: "tickDirection"+ size: 0.80082819046101150206595775671303272247314453125+ price: 6.02745618307040320615897144307382404804229736328125+ grossValue: 1.46581298050294517310021547018550336360931396484375+ trdMatchID: "trdMatchID"+ homeNotional: 5.962133916683182377482808078639209270477294921875+ timestamp: "2000-01-23T04:56:07.000+00:00"+ TradeBin:+ type: "object"+ required:+ - "symbol"+ - "timestamp"+ properties:+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ symbol:+ type: "string"+ x-dataType: "Text"+ open:+ type: "number"+ format: "double"+ x-dataType: "Double"+ high:+ type: "number"+ format: "double"+ x-dataType: "Double"+ low:+ type: "number"+ format: "double"+ x-dataType: "Double"+ close:+ type: "number"+ format: "double"+ x-dataType: "Double"+ trades:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ volume:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ vwap:+ type: "number"+ format: "double"+ x-dataType: "Double"+ lastSize:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ turnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ homeNotional:+ type: "number"+ format: "double"+ x-dataType: "Double"+ foreignNotional:+ type: "number"+ format: "double"+ x-dataType: "Double"+ example:+ symbol: "symbol"+ vwap: 7.061401241503109105224211816675961017608642578125+ trades: 5.63737665663332876420099637471139430999755859375+ homeNotional: 2.027123023002321833274663731572218239307403564453125+ volume: 2.3021358869347654518833223846741020679473876953125+ foreignNotional: 4.1456080298839363962315474054776132106781005859375+ high: 6.02745618307040320615897144307382404804229736328125+ low: 1.46581298050294517310021547018550336360931396484375+ lastSize: 9.301444243932575517419536481611430644989013671875+ close: 5.962133916683182377482808078639209270477294921875+ turnover: 3.61607674925191080461672754609026014804840087890625+ open: 0.80082819046101150206595775671303272247314453125+ timestamp: "2000-01-23T04:56:07.000+00:00"+ Wallet:+ type: "object"+ required:+ - "account"+ - "currency"+ properties:+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currency:+ type: "string"+ x-dataType: "Text"+ prevDeposited:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevWithdrawn:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevTransferIn:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevTransferOut:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevAmount:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ deltaDeposited:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ deltaWithdrawn:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ deltaTransferIn:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ deltaTransferOut:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ deltaAmount:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ deposited:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ withdrawn:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ transferIn:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ transferOut:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ amount:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ pendingCredit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ pendingDebit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ confirmedDebit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ addr:+ type: "string"+ x-dataType: "Text"+ script:+ type: "string"+ x-dataType: "Text"+ withdrawalLock:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ example:+ deposited: 7.3862819483858839220147274318151175975799560546875+ withdrawn: 1.231513536777255612975068288506008684635162353515625+ deltaDeposited: 7.061401241503109105224211816675961017608642578125+ prevWithdrawn: 1.46581298050294517310021547018550336360931396484375+ deltaWithdrawn: 9.301444243932575517419536481611430644989013671875+ currency: "currency"+ prevAmount: 2.3021358869347654518833223846741020679473876953125+ withdrawalLock:+ - "withdrawalLock"+ - "withdrawalLock"+ addr: "addr"+ prevTimestamp: "2000-01-23T04:56:07.000+00:00"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ transferOut: 1.489415909854170383397331534069962799549102783203125+ deltaAmount: 4.1456080298839363962315474054776132106781005859375+ amount: 6.8468526983526398765889098285697400569915771484375+ pendingDebit: 1.173074250955943309548956676735542714595794677734375+ confirmedDebit: 4.9652184929849543237878606305457651615142822265625+ pendingCredit: 7.4577447736837658709418974467553198337554931640625+ script: "script"+ prevTransferOut: 5.63737665663332876420099637471139430999755859375+ deltaTransferOut: 2.027123023002321833274663731572218239307403564453125+ deltaTransferIn: 3.61607674925191080461672754609026014804840087890625+ transferIn: 1.024645700144157789424070870154537260532379150390625+ prevDeposited: 6.02745618307040320615897144307382404804229736328125+ prevTransferIn: 5.962133916683182377482808078639209270477294921875+ account: 0.80082819046101150206595775671303272247314453125+ Transaction:+ type: "object"+ required:+ - "transactID"+ properties:+ transactID:+ type: "string"+ format: "guid"+ x-dataType: "Text"+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currency:+ type: "string"+ x-dataType: "Text"+ transactType:+ type: "string"+ x-dataType: "Text"+ amount:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ fee:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ transactStatus:+ type: "string"+ x-dataType: "Text"+ address:+ type: "string"+ x-dataType: "Text"+ tx:+ type: "string"+ x-dataType: "Text"+ text:+ type: "string"+ x-dataType: "Text"+ transactTime:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ example:+ amount: 6.02745618307040320615897144307382404804229736328125+ address: "address"+ transactType: "transactType"+ tx: "tx"+ transactID: "transactID"+ fee: 1.46581298050294517310021547018550336360931396484375+ transactTime: "2000-01-23T04:56:07.000+00:00"+ currency: "currency"+ text: "text"+ account: 0.80082819046101150206595775671303272247314453125+ transactStatus: "transactStatus"+ timestamp: "2000-01-23T04:56:07.000+00:00"+ AccessToken:+ type: "object"+ required:+ - "id"+ properties:+ id:+ type: "string"+ x-dataType: "Text"+ ttl:+ type: "number"+ format: "double"+ description: "time to live in seconds (2 weeks by default)"+ default: 1209600+ x-dataType: "Double"+ created:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ userId:+ type: "number"+ format: "double"+ x-dataType: "Double"+ example:+ created: "2000-01-23T04:56:07.000+00:00"+ id: "id"+ ttl: 0.80082819046101150206595775671303272247314453125+ userId: 6.02745618307040320615897144307382404804229736328125+ Affiliate:+ type: "object"+ required:+ - "account"+ - "currency"+ properties:+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currency:+ type: "string"+ x-dataType: "Text"+ prevPayout:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevTurnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevTimestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ execTurnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ execComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ totalReferrals:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ totalTurnover:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ totalComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ payoutPcnt:+ type: "number"+ format: "double"+ x-dataType: "Double"+ pendingPayout:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ referrerAccount:+ type: "number"+ format: "double"+ x-dataType: "Double"+ example:+ execTurnover: 5.63737665663332876420099637471139430999755859375+ totalTurnover: 9.301444243932575517419536481611430644989013671875+ referrerAccount: 7.3862819483858839220147274318151175975799560546875+ execComm: 2.3021358869347654518833223846741020679473876953125+ totalReferrals: 7.061401241503109105224211816675961017608642578125+ currency: "currency"+ pendingPayout: 4.1456080298839363962315474054776132106781005859375+ prevPayout: 6.02745618307040320615897144307382404804229736328125+ prevComm: 5.962133916683182377482808078639209270477294921875+ prevTimestamp: "2000-01-23T04:56:07.000+00:00"+ account: 0.80082819046101150206595775671303272247314453125+ prevTurnover: 1.46581298050294517310021547018550336360931396484375+ totalComm: 3.61607674925191080461672754609026014804840087890625+ payoutPcnt: 2.027123023002321833274663731572218239307403564453125+ timestamp: "2000-01-23T04:56:07.000+00:00"+ User:+ type: "object"+ required:+ - "email"+ - "username"+ properties:+ id:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ ownerId:+ type: "number"+ format: "int32"+ x-dataType: "Double"+ firstname:+ type: "string"+ x-dataType: "Text"+ lastname:+ type: "string"+ x-dataType: "Text"+ username:+ type: "string"+ x-dataType: "Text"+ email:+ type: "string"+ x-dataType: "Text"+ phone:+ type: "string"+ x-dataType: "Text"+ created:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ lastUpdated:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ preferences:+ $ref: "#/definitions/UserPreferences"+ x-dataType: "UserPreferences"+ TFAEnabled:+ type: "string"+ x-dataType: "Text"+ affiliateID:+ type: "string"+ maxLength: 6+ x-dataType: "Text"+ pgpPubKey:+ type: "string"+ maxLength: 16384+ x-dataType: "Text"+ country:+ type: "string"+ maxLength: 3+ x-dataType: "Text"+ description: "Account Operations"+ example:+ country: "country"+ firstname: "firstname"+ preferences:+ hideNotifications:+ - "hideNotifications"+ - "hideNotifications"+ tickerGroup: "tickerGroup"+ animationsEnabled: true+ alertOnLiquidations: true+ locale: "en-US"+ hideConfirmDialogs:+ - "hideConfirmDialogs"+ - "hideConfirmDialogs"+ disableEmails:+ - "disableEmails"+ - "disableEmails"+ sounds:+ - "sounds"+ - "sounds"+ colorTheme: "colorTheme"+ currency: "currency"+ hideNameFromLeaderboard: true+ tradeLayout: "tradeLayout"+ strictTimeout: true+ orderBookBinning: "{}"+ debug: true+ strictIPCheck: false+ msgsSeen:+ - "msgsSeen"+ - "msgsSeen"+ orderControlsPlusMinus: true+ hideConnectionModal: true+ tickerPinned: true+ hideFromLeaderboard: false+ announcementsLastSeen: "2000-01-23T04:56:07.000+00:00"+ orderBookType: "orderBookType"+ orderClearImmediate: false+ chatChannelID: 1.46581298050294517310021547018550336360931396484375+ created: "2000-01-23T04:56:07.000+00:00"+ ownerId: 6.02745618307040320615897144307382404804229736328125+ affiliateID: "affiliateID"+ lastname: "lastname"+ lastUpdated: "2000-01-23T04:56:07.000+00:00"+ phone: "phone"+ TFAEnabled: "TFAEnabled"+ id: 0.80082819046101150206595775671303272247314453125+ email: "email"+ pgpPubKey: "pgpPubKey"+ username: "username"+ UserCommission:+ type: "object"+ properties:+ makerFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ takerFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ settlementFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ maxFee:+ type: "number"+ format: "double"+ x-dataType: "Double"+ example:+ takerFee: 6.02745618307040320615897144307382404804229736328125+ makerFee: 0.80082819046101150206595775671303272247314453125+ settlementFee: 1.46581298050294517310021547018550336360931396484375+ maxFee: 5.962133916683182377482808078639209270477294921875+ Margin:+ type: "object"+ required:+ - "account"+ - "currency"+ properties:+ account:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ currency:+ type: "string"+ x-dataType: "Text"+ riskLimit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevState:+ type: "string"+ x-dataType: "Text"+ state:+ type: "string"+ x-dataType: "Text"+ action:+ type: "string"+ x-dataType: "Text"+ amount:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ pendingCredit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ pendingDebit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ confirmedDebit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevRealisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ prevUnrealisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossComm:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossOpenCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossOpenPremium:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossExecCost:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ grossMarkValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ riskValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ taxableMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ initMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ maintMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ sessionMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ targetExcessMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ varMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ realisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedPnl:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ indicativeTax:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ unrealisedProfit:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ syntheticMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ walletBalance:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ marginBalance:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ marginBalancePcnt:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ marginLeverage:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ marginUsedPcnt:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ excessMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ excessMarginPcnt:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ availableMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ withdrawableMargin:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ timestamp:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ grossLastValue:+ type: "number"+ format: "int64"+ x-dataType: "Double"+ commission:+ type: "number"+ format: "double"+ default: 0+ x-dataType: "Double"+ example:+ grossMarkValue: 1.231513536777255612975068288506008684635162353515625+ marginUsedPcnt: 2.884162126668780246063761296682059764862060546875+ marginLeverage: 1.2846590061165319429647979632136411964893341064453125+ marginBalancePcnt: 6.96511769763884558415156789124011993408203125+ unrealisedPnl: 9.3693102714106686335071572102606296539306640625+ riskLimit: 6.02745618307040320615897144307382404804229736328125+ prevUnrealisedPnl: 9.301444243932575517419536481611430644989013671875+ walletBalance: 6.438423552598546706349225132726132869720458984375+ grossLastValue: 3.35319334701124294184637619764544069766998291015625+ action: "action"+ currency: "currency"+ commission: 3.093745262666447448651751983561553061008453369140625+ state: "state"+ sessionMargin: 1.173074250955943309548956676735542714595794677734375+ marginBalance: 3.557195227068097320710649000830017030239105224609375+ timestamp: "2000-01-23T04:56:07.000+00:00"+ grossExecCost: 7.3862819483858839220147274318151175975799560546875+ targetExcessMargin: 4.9652184929849543237878606305457651615142822265625+ realisedPnl: 9.965781217890562260208753286860883235931396484375+ varMargin: 5.02500479152029466689555192715488374233245849609375+ indicativeTax: 6.683562403749608193948006373830139636993408203125+ amount: 1.46581298050294517310021547018550336360931396484375+ maintMargin: 7.4577447736837658709418974467553198337554931640625+ pendingDebit: 5.63737665663332876420099637471139430999755859375+ riskValue: 1.024645700144157789424070870154537260532379150390625+ confirmedDebit: 2.3021358869347654518833223846741020679473876953125+ grossComm: 3.61607674925191080461672754609026014804840087890625+ grossOpenPremium: 4.1456080298839363962315474054776132106781005859375+ excessMarginPcnt: 6.87805222012787620400331434211693704128265380859375+ withdrawableMargin: 6.70401929795003592715829654480330646038055419921875+ pendingCredit: 5.962133916683182377482808078639209270477294921875+ grossOpenCost: 2.027123023002321833274663731572218239307403564453125+ prevState: "prevState"+ prevRealisedPnl: 7.061401241503109105224211816675961017608642578125+ excessMargin: 6.77832496304801335185175048536621034145355224609375+ unrealisedProfit: 8.7620420127490010742121739895083010196685791015625+ initMargin: 6.8468526983526398765889098285697400569915771484375+ syntheticMargin: 9.0183481860707832566959041287191212177276611328125+ taxableMargin: 1.489415909854170383397331534069962799549102783203125+ account: 0.80082819046101150206595775671303272247314453125+ availableMargin: 5.94489560761401580890606055618263781070709228515625+ UserPreferences:+ type: "object"+ properties:+ alertOnLiquidations:+ type: "boolean"+ x-dataType: "Bool"+ animationsEnabled:+ type: "boolean"+ x-dataType: "Bool"+ announcementsLastSeen:+ type: "string"+ format: "date-time"+ x-dataType: "DateTime"+ chatChannelID:+ type: "number"+ format: "double"+ x-dataType: "Double"+ colorTheme:+ type: "string"+ x-dataType: "Text"+ currency:+ type: "string"+ x-dataType: "Text"+ debug:+ type: "boolean"+ x-dataType: "Bool"+ disableEmails:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ hideConfirmDialogs:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ hideConnectionModal:+ type: "boolean"+ x-dataType: "Bool"+ hideFromLeaderboard:+ type: "boolean"+ default: false+ x-dataType: "Bool"+ hideNameFromLeaderboard:+ type: "boolean"+ default: true+ x-dataType: "Bool"+ hideNotifications:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ locale:+ type: "string"+ default: "en-US"+ x-dataType: "Text"+ msgsSeen:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ orderBookBinning:+ type: "object"+ properties: {}+ x-dataType: "A.Value"+ orderBookType:+ type: "string"+ x-dataType: "Text"+ orderClearImmediate:+ type: "boolean"+ default: false+ x-dataType: "Bool"+ orderControlsPlusMinus:+ type: "boolean"+ x-dataType: "Bool"+ sounds:+ type: "array"+ items:+ type: "string"+ x-dataType: "[Text]"+ strictIPCheck:+ type: "boolean"+ default: false+ x-dataType: "Bool"+ strictTimeout:+ type: "boolean"+ default: true+ x-dataType: "Bool"+ tickerGroup:+ type: "string"+ x-dataType: "Text"+ tickerPinned:+ type: "boolean"+ x-dataType: "Bool"+ tradeLayout:+ type: "string"+ x-dataType: "Text"+ example:+ hideNotifications:+ - "hideNotifications"+ - "hideNotifications"+ tickerGroup: "tickerGroup"+ animationsEnabled: true+ alertOnLiquidations: true+ locale: "en-US"+ hideConfirmDialogs:+ - "hideConfirmDialogs"+ - "hideConfirmDialogs"+ disableEmails:+ - "disableEmails"+ - "disableEmails"+ sounds:+ - "sounds"+ - "sounds"+ colorTheme: "colorTheme"+ currency: "currency"+ hideNameFromLeaderboard: true+ tradeLayout: "tradeLayout"+ strictTimeout: true+ orderBookBinning: "{}"+ debug: true+ strictIPCheck: false+ msgsSeen:+ - "msgsSeen"+ - "msgsSeen"+ orderControlsPlusMinus: true+ hideConnectionModal: true+ tickerPinned: true+ hideFromLeaderboard: false+ announcementsLastSeen: "2000-01-23T04:56:07.000+00:00"+ orderBookType: "orderBookType"+ orderClearImmediate: false+ chatChannelID: 1.46581298050294517310021547018550336360931396484375+ inline_response_200:+ properties:+ success:+ type: "boolean"+ x-dataType: "Bool"+ example:+ success: true+ Error_error:+ properties:+ message:+ type: "string"+ x-dataType: "Text"+ name:+ type: "string"+ x-dataType: "Text"
+ tests/ApproxEq.hs view
@@ -0,0 +1,81 @@+{-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TypeOperators #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++module ApproxEq where++import Data.Text (Text)+import Data.Time.Clock+import Test.QuickCheck+import GHC.Generics as G++(==~)+ :: (ApproxEq a, Show a)+ => a -> a -> Property+a ==~ b = counterexample (show a ++ " !=~ " ++ show b) (a =~ b)++class GApproxEq f where+ gApproxEq :: f a -> f a -> Bool++instance GApproxEq U1 where+ gApproxEq U1 U1 = True++instance (GApproxEq a, GApproxEq b) =>+ GApproxEq (a :+: b) where+ gApproxEq (L1 a) (L1 b) = gApproxEq a b+ gApproxEq (R1 a) (R1 b) = gApproxEq a b+ gApproxEq _ _ = False++instance (GApproxEq a, GApproxEq b) =>+ GApproxEq (a :*: b) where+ gApproxEq (a1 :*: b1) (a2 :*: b2) = gApproxEq a1 a2 && gApproxEq b1 b2++instance (ApproxEq a) =>+ GApproxEq (K1 i a) where+ gApproxEq (K1 a) (K1 b) = a =~ b++instance (GApproxEq f) =>+ GApproxEq (M1 i t f) where+ gApproxEq (M1 a) (M1 b) = gApproxEq a b++class ApproxEq a where+ (=~) :: a -> a -> Bool+ default (=~) :: (Generic a, GApproxEq (Rep a)) => a -> a -> Bool+ a =~ b = gApproxEq (G.from a) (G.from b)++instance ApproxEq Text where+ (=~) = (==)++instance ApproxEq Char where+ (=~) = (==)++instance ApproxEq Bool where+ (=~) = (==)++instance ApproxEq Int where+ (=~) = (==)++instance ApproxEq Double where+ (=~) = (==)++instance ApproxEq a =>+ ApproxEq (Maybe a)++instance ApproxEq UTCTime where+ (=~) = (==)++instance ApproxEq a =>+ ApproxEq [a] where+ as =~ bs = and (zipWith (=~) as bs)++instance (ApproxEq l, ApproxEq r) =>+ ApproxEq (Either l r) where+ Left a =~ Left b = a =~ b+ Right a =~ Right b = a =~ b+ _ =~ _ = False++instance (ApproxEq l, ApproxEq r) =>+ ApproxEq (l, r) where+ (=~) (l1, r1) (l2, r2) = l1 =~ l2 && r1 =~ r2
+ tests/Instances.hs view
@@ -0,0 +1,782 @@+{-# OPTIONS_GHC -fno-warn-unused-imports #-}++module Instances where++import BitMEX.Model+import BitMEX.Core++import qualified Data.Aeson as A+import qualified Data.ByteString.Lazy as BL+import qualified Data.HashMap.Strict as HM+import qualified Data.Set as Set+import qualified Data.Text as T+import qualified Data.Time as TI+import qualified Data.Vector as V++import Control.Monad+import Data.Char (isSpace)+import Data.List (sort)+import Test.QuickCheck++import ApproxEq++instance Arbitrary T.Text where+ arbitrary = T.pack <$> arbitrary++instance Arbitrary TI.Day where+ arbitrary = TI.ModifiedJulianDay . (2000 +) <$> arbitrary+ shrink = (TI.ModifiedJulianDay <$>) . shrink . TI.toModifiedJulianDay++instance Arbitrary TI.UTCTime where+ arbitrary =+ TI.UTCTime <$> arbitrary <*> (TI.secondsToDiffTime <$> choose (0, 86401))++instance Arbitrary BL.ByteString where+ arbitrary = BL.pack <$> arbitrary+ shrink xs = BL.pack <$> shrink (BL.unpack xs)++instance Arbitrary ByteArray where+ arbitrary = ByteArray <$> arbitrary+ shrink (ByteArray xs) = ByteArray <$> shrink xs++instance Arbitrary Binary where+ arbitrary = Binary <$> arbitrary+ shrink (Binary xs) = Binary <$> shrink xs++instance Arbitrary DateTime where+ arbitrary = DateTime <$> arbitrary+ shrink (DateTime xs) = DateTime <$> shrink xs++instance Arbitrary Date where+ arbitrary = Date <$> arbitrary+ shrink (Date xs) = Date <$> shrink xs++-- | A naive Arbitrary instance for A.Value:+instance Arbitrary A.Value where+ arbitrary = frequency [(3, simpleTypes), (1, arrayTypes), (1, objectTypes)]+ where+ simpleTypes :: Gen A.Value+ simpleTypes =+ frequency+ [ (1, return A.Null)+ , (2, liftM A.Bool (arbitrary :: Gen Bool))+ , (2, liftM (A.Number . fromIntegral) (arbitrary :: Gen Int))+ , (2, liftM (A.String . T.pack) (arbitrary :: Gen String))+ ]+ mapF (k, v) = (T.pack k, v)+ simpleAndArrays = frequency [(1, sized sizedArray), (4, simpleTypes)]+ arrayTypes = sized sizedArray+ objectTypes = sized sizedObject+ sizedArray n = liftM (A.Array . V.fromList) $ replicateM n simpleTypes+ sizedObject n =+ liftM (A.object . map mapF) $+ replicateM n $ (,) <$> (arbitrary :: Gen String) <*> simpleAndArrays+ +-- | Checks if a given list has no duplicates in _O(n log n)_.+hasNoDups+ :: (Ord a)+ => [a] -> Bool+hasNoDups = go Set.empty+ where+ go _ [] = True+ go s (x:xs)+ | s' <- Set.insert x s+ , Set.size s' > Set.size s = go s' xs+ | otherwise = False++instance ApproxEq TI.Day where+ (=~) = (==)++-- * Models+ +instance Arbitrary APIKey where+ arbitrary =+ APIKey+ <$> arbitrary -- aPIKeyId :: Text+ <*> arbitrary -- aPIKeySecret :: Text+ <*> arbitrary -- aPIKeyName :: Text+ <*> arbitrary -- aPIKeyNonce :: Double+ <*> arbitrary -- aPIKeyCidr :: Maybe Text+ <*> arbitrary -- aPIKeyPermissions :: Maybe [XAny]+ <*> arbitrary -- aPIKeyEnabled :: Maybe Bool+ <*> arbitrary -- aPIKeyUserId :: Double+ <*> arbitrary -- aPIKeyCreated :: Maybe DateTime+ +instance Arbitrary AccessToken where+ arbitrary =+ AccessToken+ <$> arbitrary -- accessTokenId :: Text+ <*> arbitrary -- accessTokenTtl :: Maybe Double+ <*> arbitrary -- accessTokenCreated :: Maybe DateTime+ <*> arbitrary -- accessTokenUserId :: Maybe Double+ +instance Arbitrary Affiliate where+ arbitrary =+ Affiliate+ <$> arbitrary -- affiliateAccount :: Double+ <*> arbitrary -- affiliateCurrency :: Text+ <*> arbitrary -- affiliatePrevPayout :: Maybe Double+ <*> arbitrary -- affiliatePrevTurnover :: Maybe Double+ <*> arbitrary -- affiliatePrevComm :: Maybe Double+ <*> arbitrary -- affiliatePrevTimestamp :: Maybe DateTime+ <*> arbitrary -- affiliateExecTurnover :: Maybe Double+ <*> arbitrary -- affiliateExecComm :: Maybe Double+ <*> arbitrary -- affiliateTotalReferrals :: Maybe Double+ <*> arbitrary -- affiliateTotalTurnover :: Maybe Double+ <*> arbitrary -- affiliateTotalComm :: Maybe Double+ <*> arbitrary -- affiliatePayoutPcnt :: Maybe Double+ <*> arbitrary -- affiliatePendingPayout :: Maybe Double+ <*> arbitrary -- affiliateTimestamp :: Maybe DateTime+ <*> arbitrary -- affiliateReferrerAccount :: Maybe Double+ +instance Arbitrary Announcement where+ arbitrary =+ Announcement+ <$> arbitrary -- announcementId :: Double+ <*> arbitrary -- announcementLink :: Maybe Text+ <*> arbitrary -- announcementTitle :: Maybe Text+ <*> arbitrary -- announcementContent :: Maybe Text+ <*> arbitrary -- announcementDate :: Maybe DateTime+ +instance Arbitrary Chat where+ arbitrary =+ Chat+ <$> arbitrary -- chatId :: Maybe Double+ <*> arbitrary -- chatDate :: DateTime+ <*> arbitrary -- chatUser :: Text+ <*> arbitrary -- chatMessage :: Text+ <*> arbitrary -- chatHtml :: Text+ <*> arbitrary -- chatFromBot :: Maybe Bool+ <*> arbitrary -- chatChannelId :: Maybe Double+ +instance Arbitrary ChatChannels where+ arbitrary =+ ChatChannels+ <$> arbitrary -- chatChannelsId :: Maybe Double+ <*> arbitrary -- chatChannelsName :: Text+ +instance Arbitrary ConnectedUsers where+ arbitrary =+ ConnectedUsers+ <$> arbitrary -- connectedUsersUsers :: Maybe Double+ <*> arbitrary -- connectedUsersBots :: Maybe Double+ +instance Arbitrary Error where+ arbitrary =+ Error+ <$> arbitrary -- errorError :: ErrorError+ +instance Arbitrary ErrorError where+ arbitrary =+ ErrorError+ <$> arbitrary -- errorErrorMessage :: Maybe Text+ <*> arbitrary -- errorErrorName :: Maybe Text+ +instance Arbitrary Execution where+ arbitrary =+ Execution+ <$> arbitrary -- executionExecId :: Text+ <*> arbitrary -- executionOrderId :: Maybe Text+ <*> arbitrary -- executionClOrdId :: Maybe Text+ <*> arbitrary -- executionClOrdLinkId :: Maybe Text+ <*> arbitrary -- executionAccount :: Maybe Double+ <*> arbitrary -- executionSymbol :: Maybe Text+ <*> arbitrary -- executionSide :: Maybe Text+ <*> arbitrary -- executionLastQty :: Maybe Double+ <*> arbitrary -- executionLastPx :: Maybe Double+ <*> arbitrary -- executionUnderlyingLastPx :: Maybe Double+ <*> arbitrary -- executionLastMkt :: Maybe Text+ <*> arbitrary -- executionLastLiquidityInd :: Maybe Text+ <*> arbitrary -- executionSimpleOrderQty :: Maybe Double+ <*> arbitrary -- executionOrderQty :: Maybe Double+ <*> arbitrary -- executionPrice :: Maybe Double+ <*> arbitrary -- executionDisplayQty :: Maybe Double+ <*> arbitrary -- executionStopPx :: Maybe Double+ <*> arbitrary -- executionPegOffsetValue :: Maybe Double+ <*> arbitrary -- executionPegPriceType :: Maybe Text+ <*> arbitrary -- executionCurrency :: Maybe Text+ <*> arbitrary -- executionSettlCurrency :: Maybe Text+ <*> arbitrary -- executionExecType :: Maybe Text+ <*> arbitrary -- executionOrdType :: Maybe Text+ <*> arbitrary -- executionTimeInForce :: Maybe Text+ <*> arbitrary -- executionExecInst :: Maybe Text+ <*> arbitrary -- executionContingencyType :: Maybe Text+ <*> arbitrary -- executionExDestination :: Maybe Text+ <*> arbitrary -- executionOrdStatus :: Maybe Text+ <*> arbitrary -- executionTriggered :: Maybe Text+ <*> arbitrary -- executionWorkingIndicator :: Maybe Bool+ <*> arbitrary -- executionOrdRejReason :: Maybe Text+ <*> arbitrary -- executionSimpleLeavesQty :: Maybe Double+ <*> arbitrary -- executionLeavesQty :: Maybe Double+ <*> arbitrary -- executionSimpleCumQty :: Maybe Double+ <*> arbitrary -- executionCumQty :: Maybe Double+ <*> arbitrary -- executionAvgPx :: Maybe Double+ <*> arbitrary -- executionCommission :: Maybe Double+ <*> arbitrary -- executionTradePublishIndicator :: Maybe Text+ <*> arbitrary -- executionMultiLegReportingType :: Maybe Text+ <*> arbitrary -- executionText :: Maybe Text+ <*> arbitrary -- executionTrdMatchId :: Maybe Text+ <*> arbitrary -- executionExecCost :: Maybe Double+ <*> arbitrary -- executionExecComm :: Maybe Double+ <*> arbitrary -- executionHomeNotional :: Maybe Double+ <*> arbitrary -- executionForeignNotional :: Maybe Double+ <*> arbitrary -- executionTransactTime :: Maybe DateTime+ <*> arbitrary -- executionTimestamp :: Maybe DateTime+ +instance Arbitrary Funding where+ arbitrary =+ Funding+ <$> arbitrary -- fundingTimestamp :: DateTime+ <*> arbitrary -- fundingSymbol :: Text+ <*> arbitrary -- fundingFundingInterval :: Maybe DateTime+ <*> arbitrary -- fundingFundingRate :: Maybe Double+ <*> arbitrary -- fundingFundingRateDaily :: Maybe Double+ +instance Arbitrary IndexComposite where+ arbitrary =+ IndexComposite+ <$> arbitrary -- indexCompositeTimestamp :: DateTime+ <*> arbitrary -- indexCompositeSymbol :: Maybe Text+ <*> arbitrary -- indexCompositeIndexSymbol :: Maybe Text+ <*> arbitrary -- indexCompositeReference :: Maybe Text+ <*> arbitrary -- indexCompositeLastPrice :: Maybe Double+ <*> arbitrary -- indexCompositeWeight :: Maybe Double+ <*> arbitrary -- indexCompositeLogged :: Maybe DateTime+ +instance Arbitrary InlineResponse200 where+ arbitrary =+ InlineResponse200+ <$> arbitrary -- inlineResponse200Success :: Maybe Bool+ +instance Arbitrary Instrument where+ arbitrary =+ Instrument+ <$> arbitrary -- instrumentSymbol :: Text+ <*> arbitrary -- instrumentRootSymbol :: Maybe Text+ <*> arbitrary -- instrumentState :: Maybe Text+ <*> arbitrary -- instrumentTyp :: Maybe Text+ <*> arbitrary -- instrumentListing :: Maybe DateTime+ <*> arbitrary -- instrumentFront :: Maybe DateTime+ <*> arbitrary -- instrumentExpiry :: Maybe DateTime+ <*> arbitrary -- instrumentSettle :: Maybe DateTime+ <*> arbitrary -- instrumentRelistInterval :: Maybe DateTime+ <*> arbitrary -- instrumentInverseLeg :: Maybe Text+ <*> arbitrary -- instrumentSellLeg :: Maybe Text+ <*> arbitrary -- instrumentBuyLeg :: Maybe Text+ <*> arbitrary -- instrumentPositionCurrency :: Maybe Text+ <*> arbitrary -- instrumentUnderlying :: Maybe Text+ <*> arbitrary -- instrumentQuoteCurrency :: Maybe Text+ <*> arbitrary -- instrumentUnderlyingSymbol :: Maybe Text+ <*> arbitrary -- instrumentReference :: Maybe Text+ <*> arbitrary -- instrumentReferenceSymbol :: Maybe Text+ <*> arbitrary -- instrumentCalcInterval :: Maybe DateTime+ <*> arbitrary -- instrumentPublishInterval :: Maybe DateTime+ <*> arbitrary -- instrumentPublishTime :: Maybe DateTime+ <*> arbitrary -- instrumentMaxOrderQty :: Maybe Double+ <*> arbitrary -- instrumentMaxPrice :: Maybe Double+ <*> arbitrary -- instrumentLotSize :: Maybe Double+ <*> arbitrary -- instrumentTickSize :: Maybe Double+ <*> arbitrary -- instrumentMultiplier :: Maybe Double+ <*> arbitrary -- instrumentSettlCurrency :: Maybe Text+ <*> arbitrary -- instrumentUnderlyingToPositionMultiplier :: Maybe Double+ <*> arbitrary -- instrumentUnderlyingToSettleMultiplier :: Maybe Double+ <*> arbitrary -- instrumentQuoteToSettleMultiplier :: Maybe Double+ <*> arbitrary -- instrumentIsQuanto :: Maybe Bool+ <*> arbitrary -- instrumentIsInverse :: Maybe Bool+ <*> arbitrary -- instrumentInitMargin :: Maybe Double+ <*> arbitrary -- instrumentMaintMargin :: Maybe Double+ <*> arbitrary -- instrumentRiskLimit :: Maybe Double+ <*> arbitrary -- instrumentRiskStep :: Maybe Double+ <*> arbitrary -- instrumentLimit :: Maybe Double+ <*> arbitrary -- instrumentCapped :: Maybe Bool+ <*> arbitrary -- instrumentTaxed :: Maybe Bool+ <*> arbitrary -- instrumentDeleverage :: Maybe Bool+ <*> arbitrary -- instrumentMakerFee :: Maybe Double+ <*> arbitrary -- instrumentTakerFee :: Maybe Double+ <*> arbitrary -- instrumentSettlementFee :: Maybe Double+ <*> arbitrary -- instrumentInsuranceFee :: Maybe Double+ <*> arbitrary -- instrumentFundingBaseSymbol :: Maybe Text+ <*> arbitrary -- instrumentFundingQuoteSymbol :: Maybe Text+ <*> arbitrary -- instrumentFundingPremiumSymbol :: Maybe Text+ <*> arbitrary -- instrumentFundingTimestamp :: Maybe DateTime+ <*> arbitrary -- instrumentFundingInterval :: Maybe DateTime+ <*> arbitrary -- instrumentFundingRate :: Maybe Double+ <*> arbitrary -- instrumentIndicativeFundingRate :: Maybe Double+ <*> arbitrary -- instrumentRebalanceTimestamp :: Maybe DateTime+ <*> arbitrary -- instrumentRebalanceInterval :: Maybe DateTime+ <*> arbitrary -- instrumentOpeningTimestamp :: Maybe DateTime+ <*> arbitrary -- instrumentClosingTimestamp :: Maybe DateTime+ <*> arbitrary -- instrumentSessionInterval :: Maybe DateTime+ <*> arbitrary -- instrumentPrevClosePrice :: Maybe Double+ <*> arbitrary -- instrumentLimitDownPrice :: Maybe Double+ <*> arbitrary -- instrumentLimitUpPrice :: Maybe Double+ <*> arbitrary -- instrumentBankruptLimitDownPrice :: Maybe Double+ <*> arbitrary -- instrumentBankruptLimitUpPrice :: Maybe Double+ <*> arbitrary -- instrumentPrevTotalVolume :: Maybe Double+ <*> arbitrary -- instrumentTotalVolume :: Maybe Double+ <*> arbitrary -- instrumentVolume :: Maybe Double+ <*> arbitrary -- instrumentVolume24h :: Maybe Double+ <*> arbitrary -- instrumentPrevTotalTurnover :: Maybe Double+ <*> arbitrary -- instrumentTotalTurnover :: Maybe Double+ <*> arbitrary -- instrumentTurnover :: Maybe Double+ <*> arbitrary -- instrumentTurnover24h :: Maybe Double+ <*> arbitrary -- instrumentPrevPrice24h :: Maybe Double+ <*> arbitrary -- instrumentVwap :: Maybe Double+ <*> arbitrary -- instrumentHighPrice :: Maybe Double+ <*> arbitrary -- instrumentLowPrice :: Maybe Double+ <*> arbitrary -- instrumentLastPrice :: Maybe Double+ <*> arbitrary -- instrumentLastPriceProtected :: Maybe Double+ <*> arbitrary -- instrumentLastTickDirection :: Maybe Text+ <*> arbitrary -- instrumentLastChangePcnt :: Maybe Double+ <*> arbitrary -- instrumentBidPrice :: Maybe Double+ <*> arbitrary -- instrumentMidPrice :: Maybe Double+ <*> arbitrary -- instrumentAskPrice :: Maybe Double+ <*> arbitrary -- instrumentImpactBidPrice :: Maybe Double+ <*> arbitrary -- instrumentImpactMidPrice :: Maybe Double+ <*> arbitrary -- instrumentImpactAskPrice :: Maybe Double+ <*> arbitrary -- instrumentHasLiquidity :: Maybe Bool+ <*> arbitrary -- instrumentOpenInterest :: Maybe Double+ <*> arbitrary -- instrumentOpenValue :: Maybe Double+ <*> arbitrary -- instrumentFairMethod :: Maybe Text+ <*> arbitrary -- instrumentFairBasisRate :: Maybe Double+ <*> arbitrary -- instrumentFairBasis :: Maybe Double+ <*> arbitrary -- instrumentFairPrice :: Maybe Double+ <*> arbitrary -- instrumentMarkMethod :: Maybe Text+ <*> arbitrary -- instrumentMarkPrice :: Maybe Double+ <*> arbitrary -- instrumentIndicativeTaxRate :: Maybe Double+ <*> arbitrary -- instrumentIndicativeSettlePrice :: Maybe Double+ <*> arbitrary -- instrumentSettledPrice :: Maybe Double+ <*> arbitrary -- instrumentTimestamp :: Maybe DateTime+ +instance Arbitrary InstrumentInterval where+ arbitrary =+ InstrumentInterval+ <$> arbitrary -- instrumentIntervalIntervals :: [Text]+ <*> arbitrary -- instrumentIntervalSymbols :: [Text]+ +instance Arbitrary Insurance where+ arbitrary =+ Insurance+ <$> arbitrary -- insuranceCurrency :: Text+ <*> arbitrary -- insuranceTimestamp :: DateTime+ <*> arbitrary -- insuranceWalletBalance :: Maybe Double+ +instance Arbitrary Leaderboard where+ arbitrary =+ Leaderboard+ <$> arbitrary -- leaderboardName :: Text+ <*> arbitrary -- leaderboardIsRealName :: Maybe Bool+ <*> arbitrary -- leaderboardIsMe :: Maybe Bool+ <*> arbitrary -- leaderboardProfit :: Maybe Double+ +instance Arbitrary Liquidation where+ arbitrary =+ Liquidation+ <$> arbitrary -- liquidationOrderId :: Text+ <*> arbitrary -- liquidationSymbol :: Maybe Text+ <*> arbitrary -- liquidationSide :: Maybe Text+ <*> arbitrary -- liquidationPrice :: Maybe Double+ <*> arbitrary -- liquidationLeavesQty :: Maybe Double+ +instance Arbitrary Margin where+ arbitrary =+ Margin+ <$> arbitrary -- marginAccount :: Double+ <*> arbitrary -- marginCurrency :: Text+ <*> arbitrary -- marginRiskLimit :: Maybe Double+ <*> arbitrary -- marginPrevState :: Maybe Text+ <*> arbitrary -- marginState :: Maybe Text+ <*> arbitrary -- marginAction :: Maybe Text+ <*> arbitrary -- marginAmount :: Maybe Double+ <*> arbitrary -- marginPendingCredit :: Maybe Double+ <*> arbitrary -- marginPendingDebit :: Maybe Double+ <*> arbitrary -- marginConfirmedDebit :: Maybe Double+ <*> arbitrary -- marginPrevRealisedPnl :: Maybe Double+ <*> arbitrary -- marginPrevUnrealisedPnl :: Maybe Double+ <*> arbitrary -- marginGrossComm :: Maybe Double+ <*> arbitrary -- marginGrossOpenCost :: Maybe Double+ <*> arbitrary -- marginGrossOpenPremium :: Maybe Double+ <*> arbitrary -- marginGrossExecCost :: Maybe Double+ <*> arbitrary -- marginGrossMarkValue :: Maybe Double+ <*> arbitrary -- marginRiskValue :: Maybe Double+ <*> arbitrary -- marginTaxableMargin :: Maybe Double+ <*> arbitrary -- marginInitMargin :: Maybe Double+ <*> arbitrary -- marginMaintMargin :: Maybe Double+ <*> arbitrary -- marginSessionMargin :: Maybe Double+ <*> arbitrary -- marginTargetExcessMargin :: Maybe Double+ <*> arbitrary -- marginVarMargin :: Maybe Double+ <*> arbitrary -- marginRealisedPnl :: Maybe Double+ <*> arbitrary -- marginUnrealisedPnl :: Maybe Double+ <*> arbitrary -- marginIndicativeTax :: Maybe Double+ <*> arbitrary -- marginUnrealisedProfit :: Maybe Double+ <*> arbitrary -- marginSyntheticMargin :: Maybe Double+ <*> arbitrary -- marginWalletBalance :: Maybe Double+ <*> arbitrary -- marginMarginBalance :: Maybe Double+ <*> arbitrary -- marginMarginBalancePcnt :: Maybe Double+ <*> arbitrary -- marginMarginLeverage :: Maybe Double+ <*> arbitrary -- marginMarginUsedPcnt :: Maybe Double+ <*> arbitrary -- marginExcessMargin :: Maybe Double+ <*> arbitrary -- marginExcessMarginPcnt :: Maybe Double+ <*> arbitrary -- marginAvailableMargin :: Maybe Double+ <*> arbitrary -- marginWithdrawableMargin :: Maybe Double+ <*> arbitrary -- marginTimestamp :: Maybe DateTime+ <*> arbitrary -- marginGrossLastValue :: Maybe Double+ <*> arbitrary -- marginCommission :: Maybe Double+ +instance Arbitrary Notification where+ arbitrary =+ Notification+ <$> arbitrary -- notificationId :: Maybe Double+ <*> arbitrary -- notificationDate :: DateTime+ <*> arbitrary -- notificationTitle :: Text+ <*> arbitrary -- notificationBody :: Text+ <*> arbitrary -- notificationTtl :: Double+ <*> arbitrary -- notificationType :: Maybe Text+ <*> arbitrary -- notificationClosable :: Maybe Bool+ <*> arbitrary -- notificationPersist :: Maybe Bool+ <*> arbitrary -- notificationWaitForVisibility :: Maybe Bool+ <*> arbitrary -- notificationSound :: Maybe Text+ +instance Arbitrary Order where+ arbitrary =+ Order+ <$> arbitrary -- orderOrderId :: Text+ <*> arbitrary -- orderClOrdId :: Maybe Text+ <*> arbitrary -- orderClOrdLinkId :: Maybe Text+ <*> arbitrary -- orderAccount :: Maybe Double+ <*> arbitrary -- orderSymbol :: Maybe Text+ <*> arbitrary -- orderSide :: Maybe Text+ <*> arbitrary -- orderSimpleOrderQty :: Maybe Double+ <*> arbitrary -- orderOrderQty :: Maybe Double+ <*> arbitrary -- orderPrice :: Maybe Double+ <*> arbitrary -- orderDisplayQty :: Maybe Double+ <*> arbitrary -- orderStopPx :: Maybe Double+ <*> arbitrary -- orderPegOffsetValue :: Maybe Double+ <*> arbitrary -- orderPegPriceType :: Maybe Text+ <*> arbitrary -- orderCurrency :: Maybe Text+ <*> arbitrary -- orderSettlCurrency :: Maybe Text+ <*> arbitrary -- orderOrdType :: Maybe Text+ <*> arbitrary -- orderTimeInForce :: Maybe Text+ <*> arbitrary -- orderExecInst :: Maybe Text+ <*> arbitrary -- orderContingencyType :: Maybe Text+ <*> arbitrary -- orderExDestination :: Maybe Text+ <*> arbitrary -- orderOrdStatus :: Maybe Text+ <*> arbitrary -- orderTriggered :: Maybe Text+ <*> arbitrary -- orderWorkingIndicator :: Maybe Bool+ <*> arbitrary -- orderOrdRejReason :: Maybe Text+ <*> arbitrary -- orderSimpleLeavesQty :: Maybe Double+ <*> arbitrary -- orderLeavesQty :: Maybe Double+ <*> arbitrary -- orderSimpleCumQty :: Maybe Double+ <*> arbitrary -- orderCumQty :: Maybe Double+ <*> arbitrary -- orderAvgPx :: Maybe Double+ <*> arbitrary -- orderMultiLegReportingType :: Maybe Text+ <*> arbitrary -- orderText :: Maybe Text+ <*> arbitrary -- orderTransactTime :: Maybe DateTime+ <*> arbitrary -- orderTimestamp :: Maybe DateTime+ +instance Arbitrary OrderBook where+ arbitrary =+ OrderBook+ <$> arbitrary -- orderBookSymbol :: Text+ <*> arbitrary -- orderBookLevel :: Double+ <*> arbitrary -- orderBookBidSize :: Maybe Double+ <*> arbitrary -- orderBookBidPrice :: Maybe Double+ <*> arbitrary -- orderBookAskPrice :: Maybe Double+ <*> arbitrary -- orderBookAskSize :: Maybe Double+ <*> arbitrary -- orderBookTimestamp :: Maybe DateTime+ +instance Arbitrary OrderBookL2 where+ arbitrary =+ OrderBookL2+ <$> arbitrary -- orderBookL2Symbol :: Text+ <*> arbitrary -- orderBookL2Id :: Double+ <*> arbitrary -- orderBookL2Side :: Text+ <*> arbitrary -- orderBookL2Size :: Maybe Double+ <*> arbitrary -- orderBookL2Price :: Maybe Double+ +instance Arbitrary Position where+ arbitrary =+ Position+ <$> arbitrary -- positionAccount :: Double+ <*> arbitrary -- positionSymbol :: Text+ <*> arbitrary -- positionCurrency :: Text+ <*> arbitrary -- positionUnderlying :: Maybe Text+ <*> arbitrary -- positionQuoteCurrency :: Maybe Text+ <*> arbitrary -- positionCommission :: Maybe Double+ <*> arbitrary -- positionInitMarginReq :: Maybe Double+ <*> arbitrary -- positionMaintMarginReq :: Maybe Double+ <*> arbitrary -- positionRiskLimit :: Maybe Double+ <*> arbitrary -- positionLeverage :: Maybe Double+ <*> arbitrary -- positionCrossMargin :: Maybe Bool+ <*> arbitrary -- positionDeleveragePercentile :: Maybe Double+ <*> arbitrary -- positionRebalancedPnl :: Maybe Double+ <*> arbitrary -- positionPrevRealisedPnl :: Maybe Double+ <*> arbitrary -- positionPrevUnrealisedPnl :: Maybe Double+ <*> arbitrary -- positionPrevClosePrice :: Maybe Double+ <*> arbitrary -- positionOpeningTimestamp :: Maybe DateTime+ <*> arbitrary -- positionOpeningQty :: Maybe Double+ <*> arbitrary -- positionOpeningCost :: Maybe Double+ <*> arbitrary -- positionOpeningComm :: Maybe Double+ <*> arbitrary -- positionOpenOrderBuyQty :: Maybe Double+ <*> arbitrary -- positionOpenOrderBuyCost :: Maybe Double+ <*> arbitrary -- positionOpenOrderBuyPremium :: Maybe Double+ <*> arbitrary -- positionOpenOrderSellQty :: Maybe Double+ <*> arbitrary -- positionOpenOrderSellCost :: Maybe Double+ <*> arbitrary -- positionOpenOrderSellPremium :: Maybe Double+ <*> arbitrary -- positionExecBuyQty :: Maybe Double+ <*> arbitrary -- positionExecBuyCost :: Maybe Double+ <*> arbitrary -- positionExecSellQty :: Maybe Double+ <*> arbitrary -- positionExecSellCost :: Maybe Double+ <*> arbitrary -- positionExecQty :: Maybe Double+ <*> arbitrary -- positionExecCost :: Maybe Double+ <*> arbitrary -- positionExecComm :: Maybe Double+ <*> arbitrary -- positionCurrentTimestamp :: Maybe DateTime+ <*> arbitrary -- positionCurrentQty :: Maybe Double+ <*> arbitrary -- positionCurrentCost :: Maybe Double+ <*> arbitrary -- positionCurrentComm :: Maybe Double+ <*> arbitrary -- positionRealisedCost :: Maybe Double+ <*> arbitrary -- positionUnrealisedCost :: Maybe Double+ <*> arbitrary -- positionGrossOpenCost :: Maybe Double+ <*> arbitrary -- positionGrossOpenPremium :: Maybe Double+ <*> arbitrary -- positionGrossExecCost :: Maybe Double+ <*> arbitrary -- positionIsOpen :: Maybe Bool+ <*> arbitrary -- positionMarkPrice :: Maybe Double+ <*> arbitrary -- positionMarkValue :: Maybe Double+ <*> arbitrary -- positionRiskValue :: Maybe Double+ <*> arbitrary -- positionHomeNotional :: Maybe Double+ <*> arbitrary -- positionForeignNotional :: Maybe Double+ <*> arbitrary -- positionPosState :: Maybe Text+ <*> arbitrary -- positionPosCost :: Maybe Double+ <*> arbitrary -- positionPosCost2 :: Maybe Double+ <*> arbitrary -- positionPosCross :: Maybe Double+ <*> arbitrary -- positionPosInit :: Maybe Double+ <*> arbitrary -- positionPosComm :: Maybe Double+ <*> arbitrary -- positionPosLoss :: Maybe Double+ <*> arbitrary -- positionPosMargin :: Maybe Double+ <*> arbitrary -- positionPosMaint :: Maybe Double+ <*> arbitrary -- positionPosAllowance :: Maybe Double+ <*> arbitrary -- positionTaxableMargin :: Maybe Double+ <*> arbitrary -- positionInitMargin :: Maybe Double+ <*> arbitrary -- positionMaintMargin :: Maybe Double+ <*> arbitrary -- positionSessionMargin :: Maybe Double+ <*> arbitrary -- positionTargetExcessMargin :: Maybe Double+ <*> arbitrary -- positionVarMargin :: Maybe Double+ <*> arbitrary -- positionRealisedGrossPnl :: Maybe Double+ <*> arbitrary -- positionRealisedTax :: Maybe Double+ <*> arbitrary -- positionRealisedPnl :: Maybe Double+ <*> arbitrary -- positionUnrealisedGrossPnl :: Maybe Double+ <*> arbitrary -- positionLongBankrupt :: Maybe Double+ <*> arbitrary -- positionShortBankrupt :: Maybe Double+ <*> arbitrary -- positionTaxBase :: Maybe Double+ <*> arbitrary -- positionIndicativeTaxRate :: Maybe Double+ <*> arbitrary -- positionIndicativeTax :: Maybe Double+ <*> arbitrary -- positionUnrealisedTax :: Maybe Double+ <*> arbitrary -- positionUnrealisedPnl :: Maybe Double+ <*> arbitrary -- positionUnrealisedPnlPcnt :: Maybe Double+ <*> arbitrary -- positionUnrealisedRoePcnt :: Maybe Double+ <*> arbitrary -- positionSimpleQty :: Maybe Double+ <*> arbitrary -- positionSimpleCost :: Maybe Double+ <*> arbitrary -- positionSimpleValue :: Maybe Double+ <*> arbitrary -- positionSimplePnl :: Maybe Double+ <*> arbitrary -- positionSimplePnlPcnt :: Maybe Double+ <*> arbitrary -- positionAvgCostPrice :: Maybe Double+ <*> arbitrary -- positionAvgEntryPrice :: Maybe Double+ <*> arbitrary -- positionBreakEvenPrice :: Maybe Double+ <*> arbitrary -- positionMarginCallPrice :: Maybe Double+ <*> arbitrary -- positionLiquidationPrice :: Maybe Double+ <*> arbitrary -- positionBankruptPrice :: Maybe Double+ <*> arbitrary -- positionTimestamp :: Maybe DateTime+ <*> arbitrary -- positionLastPrice :: Maybe Double+ <*> arbitrary -- positionLastValue :: Maybe Double+ +instance Arbitrary Quote where+ arbitrary =+ Quote+ <$> arbitrary -- quoteTimestamp :: DateTime+ <*> arbitrary -- quoteSymbol :: Text+ <*> arbitrary -- quoteBidSize :: Maybe Double+ <*> arbitrary -- quoteBidPrice :: Maybe Double+ <*> arbitrary -- quoteAskPrice :: Maybe Double+ <*> arbitrary -- quoteAskSize :: Maybe Double+ +instance Arbitrary Settlement where+ arbitrary =+ Settlement+ <$> arbitrary -- settlementTimestamp :: DateTime+ <*> arbitrary -- settlementSymbol :: Text+ <*> arbitrary -- settlementSettlementType :: Maybe Text+ <*> arbitrary -- settlementSettledPrice :: Maybe Double+ <*> arbitrary -- settlementBankrupt :: Maybe Double+ <*> arbitrary -- settlementTaxBase :: Maybe Double+ <*> arbitrary -- settlementTaxRate :: Maybe Double+ +instance Arbitrary Stats where+ arbitrary =+ Stats+ <$> arbitrary -- statsRootSymbol :: Text+ <*> arbitrary -- statsCurrency :: Maybe Text+ <*> arbitrary -- statsVolume24h :: Maybe Double+ <*> arbitrary -- statsTurnover24h :: Maybe Double+ <*> arbitrary -- statsOpenInterest :: Maybe Double+ <*> arbitrary -- statsOpenValue :: Maybe Double+ +instance Arbitrary StatsHistory where+ arbitrary =+ StatsHistory+ <$> arbitrary -- statsHistoryDate :: DateTime+ <*> arbitrary -- statsHistoryRootSymbol :: Text+ <*> arbitrary -- statsHistoryCurrency :: Maybe Text+ <*> arbitrary -- statsHistoryVolume :: Maybe Double+ <*> arbitrary -- statsHistoryTurnover :: Maybe Double+ +instance Arbitrary StatsUSD where+ arbitrary =+ StatsUSD+ <$> arbitrary -- statsUSDRootSymbol :: Text+ <*> arbitrary -- statsUSDCurrency :: Maybe Text+ <*> arbitrary -- statsUSDTurnover24h :: Maybe Double+ <*> arbitrary -- statsUSDTurnover30d :: Maybe Double+ <*> arbitrary -- statsUSDTurnover365d :: Maybe Double+ <*> arbitrary -- statsUSDTurnover :: Maybe Double+ +instance Arbitrary Trade where+ arbitrary =+ Trade+ <$> arbitrary -- tradeTimestamp :: DateTime+ <*> arbitrary -- tradeSymbol :: Text+ <*> arbitrary -- tradeSide :: Maybe Text+ <*> arbitrary -- tradeSize :: Maybe Double+ <*> arbitrary -- tradePrice :: Maybe Double+ <*> arbitrary -- tradeTickDirection :: Maybe Text+ <*> arbitrary -- tradeTrdMatchId :: Maybe Text+ <*> arbitrary -- tradeGrossValue :: Maybe Double+ <*> arbitrary -- tradeHomeNotional :: Maybe Double+ <*> arbitrary -- tradeForeignNotional :: Maybe Double+ +instance Arbitrary TradeBin where+ arbitrary =+ TradeBin+ <$> arbitrary -- tradeBinTimestamp :: DateTime+ <*> arbitrary -- tradeBinSymbol :: Text+ <*> arbitrary -- tradeBinOpen :: Maybe Double+ <*> arbitrary -- tradeBinHigh :: Maybe Double+ <*> arbitrary -- tradeBinLow :: Maybe Double+ <*> arbitrary -- tradeBinClose :: Maybe Double+ <*> arbitrary -- tradeBinTrades :: Maybe Double+ <*> arbitrary -- tradeBinVolume :: Maybe Double+ <*> arbitrary -- tradeBinVwap :: Maybe Double+ <*> arbitrary -- tradeBinLastSize :: Maybe Double+ <*> arbitrary -- tradeBinTurnover :: Maybe Double+ <*> arbitrary -- tradeBinHomeNotional :: Maybe Double+ <*> arbitrary -- tradeBinForeignNotional :: Maybe Double+ +instance Arbitrary Transaction where+ arbitrary =+ Transaction+ <$> arbitrary -- transactionTransactId :: Text+ <*> arbitrary -- transactionAccount :: Maybe Double+ <*> arbitrary -- transactionCurrency :: Maybe Text+ <*> arbitrary -- transactionTransactType :: Maybe Text+ <*> arbitrary -- transactionAmount :: Maybe Double+ <*> arbitrary -- transactionFee :: Maybe Double+ <*> arbitrary -- transactionTransactStatus :: Maybe Text+ <*> arbitrary -- transactionAddress :: Maybe Text+ <*> arbitrary -- transactionTx :: Maybe Text+ <*> arbitrary -- transactionText :: Maybe Text+ <*> arbitrary -- transactionTransactTime :: Maybe DateTime+ <*> arbitrary -- transactionTimestamp :: Maybe DateTime+ +instance Arbitrary User where+ arbitrary =+ User+ <$> arbitrary -- userId :: Maybe Double+ <*> arbitrary -- userOwnerId :: Maybe Double+ <*> arbitrary -- userFirstname :: Maybe Text+ <*> arbitrary -- userLastname :: Maybe Text+ <*> arbitrary -- userUsername :: Text+ <*> arbitrary -- userEmail :: Text+ <*> arbitrary -- userPhone :: Maybe Text+ <*> arbitrary -- userCreated :: Maybe DateTime+ <*> arbitrary -- userLastUpdated :: Maybe DateTime+ <*> arbitrary -- userPreferences :: Maybe UserPreferences+ <*> arbitrary -- userTfaEnabled :: Maybe Text+ <*> arbitrary -- userAffiliateId :: Maybe Text+ <*> arbitrary -- userPgpPubKey :: Maybe Text+ <*> arbitrary -- userCountry :: Maybe Text+ +instance Arbitrary UserCommission where+ arbitrary =+ UserCommission+ <$> arbitrary -- userCommissionMakerFee :: Maybe Double+ <*> arbitrary -- userCommissionTakerFee :: Maybe Double+ <*> arbitrary -- userCommissionSettlementFee :: Maybe Double+ <*> arbitrary -- userCommissionMaxFee :: Maybe Double+ +instance Arbitrary UserPreferences where+ arbitrary =+ UserPreferences+ <$> arbitrary -- userPreferencesAlertOnLiquidations :: Maybe Bool+ <*> arbitrary -- userPreferencesAnimationsEnabled :: Maybe Bool+ <*> arbitrary -- userPreferencesAnnouncementsLastSeen :: Maybe DateTime+ <*> arbitrary -- userPreferencesChatChannelId :: Maybe Double+ <*> arbitrary -- userPreferencesColorTheme :: Maybe Text+ <*> arbitrary -- userPreferencesCurrency :: Maybe Text+ <*> arbitrary -- userPreferencesDebug :: Maybe Bool+ <*> arbitrary -- userPreferencesDisableEmails :: Maybe [Text]+ <*> arbitrary -- userPreferencesHideConfirmDialogs :: Maybe [Text]+ <*> arbitrary -- userPreferencesHideConnectionModal :: Maybe Bool+ <*> arbitrary -- userPreferencesHideFromLeaderboard :: Maybe Bool+ <*> arbitrary -- userPreferencesHideNameFromLeaderboard :: Maybe Bool+ <*> arbitrary -- userPreferencesHideNotifications :: Maybe [Text]+ <*> arbitrary -- userPreferencesLocale :: Maybe Text+ <*> arbitrary -- userPreferencesMsgsSeen :: Maybe [Text]+ <*> arbitrary -- userPreferencesOrderBookBinning :: Maybe A.Value+ <*> arbitrary -- userPreferencesOrderBookType :: Maybe Text+ <*> arbitrary -- userPreferencesOrderClearImmediate :: Maybe Bool+ <*> arbitrary -- userPreferencesOrderControlsPlusMinus :: Maybe Bool+ <*> arbitrary -- userPreferencesSounds :: Maybe [Text]+ <*> arbitrary -- userPreferencesStrictIpCheck :: Maybe Bool+ <*> arbitrary -- userPreferencesStrictTimeout :: Maybe Bool+ <*> arbitrary -- userPreferencesTickerGroup :: Maybe Text+ <*> arbitrary -- userPreferencesTickerPinned :: Maybe Bool+ <*> arbitrary -- userPreferencesTradeLayout :: Maybe Text+ +instance Arbitrary Wallet where+ arbitrary =+ Wallet+ <$> arbitrary -- walletAccount :: Double+ <*> arbitrary -- walletCurrency :: Text+ <*> arbitrary -- walletPrevDeposited :: Maybe Double+ <*> arbitrary -- walletPrevWithdrawn :: Maybe Double+ <*> arbitrary -- walletPrevTransferIn :: Maybe Double+ <*> arbitrary -- walletPrevTransferOut :: Maybe Double+ <*> arbitrary -- walletPrevAmount :: Maybe Double+ <*> arbitrary -- walletPrevTimestamp :: Maybe DateTime+ <*> arbitrary -- walletDeltaDeposited :: Maybe Double+ <*> arbitrary -- walletDeltaWithdrawn :: Maybe Double+ <*> arbitrary -- walletDeltaTransferIn :: Maybe Double+ <*> arbitrary -- walletDeltaTransferOut :: Maybe Double+ <*> arbitrary -- walletDeltaAmount :: Maybe Double+ <*> arbitrary -- walletDeposited :: Maybe Double+ <*> arbitrary -- walletWithdrawn :: Maybe Double+ <*> arbitrary -- walletTransferIn :: Maybe Double+ <*> arbitrary -- walletTransferOut :: Maybe Double+ <*> arbitrary -- walletAmount :: Maybe Double+ <*> arbitrary -- walletPendingCredit :: Maybe Double+ <*> arbitrary -- walletPendingDebit :: Maybe Double+ <*> arbitrary -- walletConfirmedDebit :: Maybe Double+ <*> arbitrary -- walletTimestamp :: Maybe DateTime+ <*> arbitrary -- walletAddr :: Maybe Text+ <*> arbitrary -- walletScript :: Maybe Text+ <*> arbitrary -- walletWithdrawalLock :: Maybe [Text]+ +instance Arbitrary XAny where+ arbitrary =+ + pure XAny+ ++++instance Arbitrary E'Type where+ arbitrary = arbitraryBoundedEnum
+ tests/PropMime.hs view
@@ -0,0 +1,51 @@+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ConstraintKinds #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-}++module PropMime where++import Data.Aeson+import Data.Aeson.Types (parseEither)+import Data.Monoid ((<>))+import Data.Typeable (Proxy(..), typeOf, Typeable)+import qualified Data.ByteString.Lazy.Char8 as BL8+import Test.Hspec+import Test.QuickCheck+import Test.QuickCheck.Property+import Test.Hspec.QuickCheck (prop)++import BitMEX.MimeTypes++import ApproxEq++-- * Type Aliases++type ArbitraryMime mime a = ArbitraryRoundtrip (MimeUnrender mime) (MimeRender mime) a++type ArbitraryRoundtrip from to a = (from a, to a, Arbitrary' a)++type Arbitrary' a = (Arbitrary a, Show a, Typeable a)++-- * Mime++propMime+ :: forall a b mime.+ (ArbitraryMime mime a, Testable b)+ => String -> (a -> a -> b) -> mime -> Proxy a -> Spec+propMime eqDescr eq m _ =+ prop+ (show (typeOf (undefined :: a)) <> " " <> show (typeOf (undefined :: mime)) <> " roundtrip " <> eqDescr) $+ \(x :: a) ->+ let rendered = mimeRender' m x+ actual = mimeUnrender' m rendered+ expected = Right x+ failMsg =+ "ACTUAL: " <> show actual <> "\nRENDERED: " <> BL8.unpack rendered+ in counterexample failMsg $+ either reject property (eq <$> actual <*> expected)+ where+ reject = property . const rejected++propMimeEq :: (ArbitraryMime mime a, Eq a) => mime -> Proxy a -> Spec+propMimeEq = propMime "(EQ)" (==)
+ tests/Test.hs view
@@ -0,0 +1,60 @@+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE PartialTypeSignatures #-}++module Main where++import Data.Typeable (Proxy(..))+import Test.Hspec+import Test.Hspec.QuickCheck++import PropMime+import Instances ()++import BitMEX.Model+import BitMEX.MimeTypes++main :: IO ()+main =+ hspec $ modifyMaxSize (const 10) $ do+ describe "JSON instances" $ do+ pure ()+ propMimeEq MimeJSON (Proxy :: Proxy APIKey)+ propMimeEq MimeJSON (Proxy :: Proxy AccessToken)+ propMimeEq MimeJSON (Proxy :: Proxy Affiliate)+ propMimeEq MimeJSON (Proxy :: Proxy Announcement)+ propMimeEq MimeJSON (Proxy :: Proxy Chat)+ propMimeEq MimeJSON (Proxy :: Proxy ChatChannels)+ propMimeEq MimeJSON (Proxy :: Proxy ConnectedUsers)+ propMimeEq MimeJSON (Proxy :: Proxy Error)+ propMimeEq MimeJSON (Proxy :: Proxy ErrorError)+ propMimeEq MimeJSON (Proxy :: Proxy Execution)+ propMimeEq MimeJSON (Proxy :: Proxy Funding)+ propMimeEq MimeJSON (Proxy :: Proxy IndexComposite)+ propMimeEq MimeJSON (Proxy :: Proxy InlineResponse200)+ propMimeEq MimeJSON (Proxy :: Proxy Instrument)+ propMimeEq MimeJSON (Proxy :: Proxy InstrumentInterval)+ propMimeEq MimeJSON (Proxy :: Proxy Insurance)+ propMimeEq MimeJSON (Proxy :: Proxy Leaderboard)+ propMimeEq MimeJSON (Proxy :: Proxy Liquidation)+ propMimeEq MimeJSON (Proxy :: Proxy Margin)+ propMimeEq MimeJSON (Proxy :: Proxy Notification)+ propMimeEq MimeJSON (Proxy :: Proxy Order)+ propMimeEq MimeJSON (Proxy :: Proxy OrderBook)+ propMimeEq MimeJSON (Proxy :: Proxy OrderBookL2)+ propMimeEq MimeJSON (Proxy :: Proxy Position)+ propMimeEq MimeJSON (Proxy :: Proxy Quote)+ propMimeEq MimeJSON (Proxy :: Proxy Settlement)+ propMimeEq MimeJSON (Proxy :: Proxy Stats)+ propMimeEq MimeJSON (Proxy :: Proxy StatsHistory)+ propMimeEq MimeJSON (Proxy :: Proxy StatsUSD)+ propMimeEq MimeJSON (Proxy :: Proxy Trade)+ propMimeEq MimeJSON (Proxy :: Proxy TradeBin)+ propMimeEq MimeJSON (Proxy :: Proxy Transaction)+ propMimeEq MimeJSON (Proxy :: Proxy User)+ propMimeEq MimeJSON (Proxy :: Proxy UserCommission)+ propMimeEq MimeJSON (Proxy :: Proxy UserPreferences)+ propMimeEq MimeJSON (Proxy :: Proxy Wallet)+ propMimeEq MimeJSON (Proxy :: Proxy XAny)+