LMEUtils
LMEUtils#
-
class sigtech.framework.instruments.lme_otc.LMEUtils
Generic common functions used internally inside of LME instruments classes.
-
exchange_code: Optional[str] = 'LME(T)'
-
spot_offset: Optional[str] = '2BD'
-
static holidays()
List of holiday calendars.
-
static timezone()
Timezone info.
-
static delivery_date(d, term)
Delivery date given reference date and term info.
- Parameters
d – Reference date.
term – Increment string stub (e.g. ‘1d’, ‘1bd’, ‘1b’, ‘1cd’).
- Returns
Delivery date.
-
static schedule_stub_lme()
Schedule stub for all LME instruments.
-
static spot_contract(underlying_ticker)
Return the contract object given an underlying ticker.
- Parameters
underlying_ticker – Ticker of the underlying.
- Returns
Object.
-
static rolling_3m_forward(underlying_ticker)
Return the 3M rolling forward given an underlying ticker.
- Parameters
underlying_ticker – Ticker of the underlying.
- Returns
Object.
-
static outright_future_name(underlying_ticker, future_ticker)
Return the outright future name given an underlying ticker and a future ticker.
- Parameters
underlying_ticker – Ticker of the underlying.
future_ticker – Ticker of the future.
- Returns
Object.
-
static outright_future(underlying_ticker, future_ticker)
Return the outright future object given an underlying ticker and a future ticker.
- Parameters
underlying_ticker – Ticker of the underlying.
future_ticker – Ticker of the future.
- Returns
Object.
-
static rolling_spread_contract_name(underlying_ticker, future_ticker)
Return the rolling spread contract name given an underlying ticker and a future ticker.
- Parameters
underlying_ticker – Ticker of the underlying.
future_ticker – Ticker of the future.
- Returns
string
-
static rolling_spread_contract(underlying_ticker, future_ticker)
Return the rolling spread contract given an underlying ticker and a future ticker.
- Parameters
underlying_ticker – Ticker of the underlying.
future_ticker – Ticker of the future.
- Returns
Object.
-
static print_tickers()
Print the available tickers.
-
static create_lme_forward(delivery_date: Union[datetime.date, str], args_dict: dict)
Create generic, 3 Month, Spot, or 3rd Wednesday LME forward(future) depending on the
delivery_date
argument:- Parameters
delivery_date –
'3M'
,'SPOT'
, forward delivery date, or future delivery month (e.g.'J19'
or'M20'
)args_dict – should contain all the remaining required parameters for the corresponding instrument.
- Returns
if
delivery_date
='3M'
,LME3MForward
is created, ifdelivery_date
='SPOT'
,LMECashForward
is created, ifdelivery_date
is a date, a genericLMEForward
is created withdelivery_date
being that date, and ifdelivery_date
is a future delivery month ticker, e.g.'K18'
or'Z20'
, a 3rd WednesdayLMEFuture
with delivery on that month is created.
Example object creation:
forward_3m = LMEUtils.create_lme_forward('3M', { 'underlying_ticker': 'LN', 'start_date': dtm.date(2017, 4, 5), })
This will create a contract, initiated on 5-Apr-2017, for delivery on 5-Jul-2017 (in 3 Months) of 6 tons of nickel at the price of 10294 per ton (6 tons is the standard nickel contract size, 10294 was the closing price of spot nickel on 5-Apr-2017).
spot = LMEUtils.create_lme_forward('SPOT', { 'underlying_ticker': 'LN', 'start_date': dtm.date(2017, 4, 5), 'strike': 10300, })
This will create a spot contract, initiated on 5-Apr-2017, for delivery on 7-Apr-2017 (spot - in 2 Days) of 6 tons of nickel at the price of 10300 per ton (6 tons is the standard nickel contract size).
future = LMEUtils.create_lme_forward('F19', { 'underlying_ticker': 'LX', 'strike': 2900, })
This will create a contract for delivery on 16-Jan-2019 (3rd Wednesday of Jan 19) of 25 tons of zinc at the price of 2900 per ton (25 tons is the standard zinc contract size).