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_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 are not supported

  • 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