Skip to content

Python package to similate a pricefeed of for instance a stock price

License

Notifications You must be signed in to change notification settings

smart-t/pricefeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PriceFeed

This is a generator for random price feeds that can be used to generate a new price at will or at predefined time intervals. The PriceFeed object will also maintain statistics on all the prices that it generated.

A typical use-case is in a development environment where you would like to mimic a pricefeed.

You can install the package via PyPI or from source.

Install from PyPI

pip install pricefeed

Install from Source (GitHub)

git clone https://github.com/smart-t/pricefeed.git
cd pricefeed
pip install .

Example: How to use this package

import pricefeed as pf

AAPL_ticker = pf.Pricefeed("AAPL", 235.0, 500, 0.001)
for i in range(10):
  print(f"{i} : {next(AAPL_ticker)}")

The above script will generate a new price every 500 miliseconds and completes a list with 10 simulated 'AAPL' stock prices starting at $235.0. The 4th argument is used to indicate how volatile the stock movement will be.

The generated prices are designed to stay relatively close to the given start price.

The third and fourth properties (delay and vol) are optional, and if not provided they default to 0ms (0sec) and a volatility of 0.01. A delay of 0ms means the object generates a new price on demand.

Contributions

This is an opensource project where you are invited to contribute and help evolve the pricefeed as we go.

About

Python package to similate a pricefeed of for instance a stock price

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages