Market Data client

class lime_trader.clients.market_data_client.MarketDataClient(api_client: AuthenticatedApiClient, logger: Logger)[source]

Bases: object

Contains methods related to market data

get_current_quote(symbol: str) Quote[source]

Retrieves current quote for the specified symbol

Parameters:

symbol – Security symbol

Returns:

Quote for the symbol

get_current_quotes(symbols: list[str]) list[Quote][source]

Retrieves current quotes for all specified symbols

Parameters:

symbols – List of security symbols

Returns:

List of quotes for specified symbols

get_option_chain(symbol: str, expiration: date, series: str | None = None) OptionChain[source]

Returns option contracts for specified symbol, expiration date and series.

Parameters:
  • symbol – The security symbol.

  • expiration – Contract expiration date

  • series – By default the series is the same as the security symbol

Returns:

Option contracts for specified symbol, expiration date and series

get_option_series(symbol: str) list[OptionSeries][source]

Returns an array of option series by the specified underlying security’s symbol. Contains at least one element which is the default series. Option Series is a specific set of calls or puts on the same underlying security, with the same strike price and expiration date. For the most part there is just one series name that matches the symbol but in some cases related to corporate actions on the underlying security additional series are issued.

Parameters:

symbol – The security symbol

Returns:

Array of option series by the specified underlying security’s symbol

get_quotes_history(symbol: str, period: Period, from_date: datetime, to_date: datetime) list[QuoteHistory][source]

Returns candle structures aggregated by specified period

Parameters:
  • symbol – The security symbol, stocks in Nasdaq CMS convention. Options in OCC

  • period – Aggregation period.

  • from_date – Period start

  • to_date – Period end

Returns:

Quote history between specified period

get_trading_schedule() CurrentSchedule[source]

Returns trading session info depending on current date and time:

Returns:

Current trading schedule

iterate_time_and_sales(symbol: str, from_date: datetime, to_date: datetime, start_page: PageRequest) Iterator[Page[AccountTransaction]][source]

Returns iterator for the time and sales history, ordered by descending timestamp

Parameters:
  • symbol – The security symbol, stocks in Nasdaq CMS convention. Options are not supported

  • from_date – Period start

  • to_date – Period end

  • start_page – Start page. Iterator starts from this page

Returns:

Iterator of pages of historical trades

lookup_securities(query: str, page: PageRequest) Page[Security][source]

Searches the securities reference by the specified criteria. The criteria can be a symbol, part of a symbol or part of a company name.

Parameters:
  • query – Search criteria

  • page – Pagination parameters

Returns:

Page of security symbols which match criteria

time_and_sales(symbol: str, from_date: datetime, to_date: datetime, page: PageRequest) Page[Trade][source]

Retrieves the time and sales history, ordered by descending timestamp. Query parameters are:

Parameters:
  • symbol – The security symbol, stocks in Nasdaq CMS convention. Options are not supported

  • from_date – Period start

  • to_date – Period end

  • page – Pagination parameters

Returns:

Page of historical trades