Members
-
<static, constant> sizes :Array.<contractSize>
-
Lists all available contract sizes.
const sizes = [ { name: 'Regular - 5,000 bushels', value: 'regular', }, { name: 'Mini - 1,000 bushels', value: 'mini', }, ];
Type:
- Array.<contractSize>
-
basisType
-
The API type name for a basis contract
-
basisTypes
-
The Old and New names for a basis contract
-
cashSaleType
-
The API type name for a cash sale contract
-
cashSaleTypes
-
The Old and New names for a cash sale contract
-
forwardType
-
The API type name for a forward contract
-
forwardTypes
-
The Old and New names for a forward contract
-
futuresType
-
The API type name for a futures contract
-
futuresTypes
-
The Old and New names for a futures contract
-
hedgeToArriveType
-
The API type name for a hedge to arrive contract
-
hedgeToArriveTypes
-
The Old and New names for a hedge to arrive contract
-
longShort
-
Lists all available contract sizes.
const longShort = [ { name: 'Long', value: 'long', }, { name: 'Short', value: 'short', }, ];
-
months
-
Lists all available contract months
const months = [ { name: 'January', value: 1, }, { name: 'February', value: 2, }, { name: 'March', value: 3, }, { name: 'April', value: 4, }, { name: 'May', value: 5, }, { name: 'June', value: 6, }, { name: 'July', value: 7, }, { name: 'August', value: 8, }, { name: 'September', value: 9, }, { name: 'October', value: 10, }, { name: 'November', value: 11, }, { name: 'December', value: 12, }, ];
-
optionSaleType
-
The API type name for an options contract
-
optionSaleTypes
-
The Old and New names for an options contract
-
optionStrategy
-
Lists all available contract option strategies
const optionStrategy = [ { name: 'Long Put', value: 'long_put', }, { name: 'Short Put', value: 'short_put', }, { name: 'Long Call', value: 'long_call', }, { name: 'Short Call', value: 'short_call', }, ];
Methods
-
isBasisType(type)
-
Checks if the given type is a basis contract
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
If the contract is a basis contract
- Type
- boolean
-
isCashSaleType(type)
-
Checks if the given type is a cash sale contract
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
If the contract is a cash sale contract
- Type
- boolean
-
isForwardType(type)
-
Checks if the given type is a forward contract
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
If the contract is a forward contract
- Type
- boolean
-
isFuturesType(type)
-
Checks if the given type is a futures contract
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
If the contract is a futures contract
- Type
- boolean
-
isHedgeToArriveType(type)
-
Checks if the given type is a hedge to arrive contract
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
If the contract is a hedge to arrive contract
- Type
- boolean
-
isOptionSaleType(type)
-
Checks if the given type is an options contract
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
If the contract is an options contract
- Type
- boolean
-
sanitize(contract, typeName, includeId)
-
Sanitizes the given contract into a valid API contract given the contract type name. Optionally exclude the id from the sanitized contract as well.
Parameters:
Name Type Default Description contract
Contract The contract to sanitize
typeName
string The type name to sanitize the contract to
includeId
boolean true If to include the id or not
Returns:
The sanitized contract
- Type
- Contract
-
sortPosition(type)
-
Sort positions for type
Parameters:
Name Type Description type
string The type_name of the given contract
Returns:
The sort position of the contract (if 7 then it is not a valid type)
- Type
- number
-
sortTypes(types)
-
Sorts a list of contract type names
Parameters:
Name Type Description types
Array.<string> The list of type_names to sort
Returns:
The sorted list of type_names
- Type
- Array.<string>
-
translateContractTypeToName(type)
-
Translates the type_name attribute of a contract to a readable name.
Parameters:
Name Type Description type
string The type_name of a given contract
Returns:
The humanized name of the contract type
- Type
- string
-
translateContractTypeToUrl(type)
-
Translates the type_name attribute of a contract to the URL version of the name.
Parameters:
Name Type Description type
string The type_name of a given contract
Returns:
The URL-ized name of the contract type
- Type
- string