1. Support Center
  2. Liberator Python User's Guide & Recipes

Accessing data from a Live Trading Environment (FAQ)

Using liberator data in a live algorithmic trading environment

Some companies do not allow third-party APIs into their live trading environments.


In those circumstances, you will have to pull the data on your local machine and then seek out an approved method of pushing the data to your trading server.

Low Frequency Data

For infrequently updated data, that solution may be as simple as arranging a file storage location that both the live trading application server and your own server can access and pushing the data there in a file at a set time. You will need to speak with your Operations department to arrange access to such a shared resource.

Higher Frequency Data

Or for higher frequency intraday updating use some kind of messaging service like ZeroMQ (popular, lightweight, end to end with no intermediate broker service).

https://zeromq.org/


Accessing Live Trading Data from Liberator

Liberator supports the delivery of live datasets in just as simple a manner as it supports historical datasets.


An imaginary example would be..


import liberator

liberator.url='https://waether.cloudquant.ai'

yesterday = ‘2024-08-01’ # see ‘Time related functions’ for how to get current dates, yesterday etc

res = liberator.query(name = 'us_live_weather', symbols = '78758', as_of = 'live', , back_to = yesterday)

for batch in res:

    df=batch.to_pandas()

    print(df)

 

If back_to was not specified then this query would start delivering live weather information for zip code 78758 at the frequency defined by the data vendor. As we have set a back_to of ‘yesterday’ it will first deliver the last 24 hours of weather and then switch into live mode automatically. No need for separate Queries.