Random stock quotes generator based on real data distribution
Project description
rndqts
Random stock market quotes
Installation
as a standalone lib.
# Set up a virtualenv.
python3 -m venv venv
source venv/bin/activate
# Install from PyPI...
pip install --upgrade pip
pip install -U rndqts
# ...or, install from updated source code.
pip install git+https://github.com/davips/rndqts
as an editable lib inside your project.
cd your-project
source venv/bin/activate
git clone https://github.com/davips/rndqts ../rndqts
pip install --upgrade pip
pip install -e ../rndqts
Examples
Fetching from Yahoo
from rndqts import Real
print(Real("VALE3.sa").data)
"""
Fetching VALE3.sa ...
[*********************100%***********************] 1 of 1 completed
Open High Low Close Volume
Date
2021-01-04 89.349998 91.480003 88.849998 91.459999 37865500
2021-01-05 91.459999 93.000000 90.519997 93.000000 34300300
2021-01-06 94.980003 96.349998 94.400002 96.050003 53722500
2021-01-07 96.610001 102.529999 96.610001 102.320000 74541400
2021-01-08 103.010002 103.349998 98.199997 101.260002 43879400
2021-01-11 100.250000 101.980003 99.699997 101.980003 29267000
2021-01-12 102.500000 102.620003 99.180000 99.190002 28598500
2021-01-13 98.870003 98.919998 95.739998 96.220001 31658800
2021-01-14 97.220001 98.860001 96.699997 97.800003 20809900
2021-01-15 96.580002 97.199997 93.199997 93.550003 31712400
"""
Random stock quotes
from rndqts import Realistic
from rndqts import Real
# Real quotes to fetch from Yahoo.
r1 = Real("PETR4.sa")
r2 = Real("CSNA3.sa")
r3 = Real("VALE3.sa")
r4 = Real("USIM5.sa")
# Generating random quotes.
print(Realistic([r1, r2, r3, r4]).data)
"""
Fetching PETR4.sa ...
[*********************100%***********************] 1 of 1 completed
Fetching CSNA3.sa ...
[*********************100%***********************] 1 of 1 completed
Fetching USIM5.sa ...
[*********************100%***********************] 1 of 1 completed
Open High Low Close Volume
Date
0 98.26 99.28 91.50 91.90 12499
1 90.76 93.85 90.24 90.26 13400
2 89.66 94.05 89.36 91.20 16749
3 90.48 93.31 89.88 90.86 13468
4 90.00 95.08 88.92 92.01 15087
... ... ... ... ... ...
67 116.65 121.32 115.36 119.70 799
68 119.63 121.19 112.72 116.76 395
69 115.84 116.76 109.17 111.38 307
70 110.73 110.73 104.34 104.55 222
71 103.25 103.91 99.63 100.01 278
[72 rows x 5 columns]
"""
Saving as a CSV file
from rndqts import Real
Real("VALE3.sa").data.to_csv("/tmp/myfile.csv")
Plotting
from rndqts import Real
Real("VALE3.sa").plot()
"""
Fetching VALE3.sa ...
[*********************100%***********************] 1 of 1 completed
"""
Features / TODO
-
Fetch from yahoo
-
Automatic local caching
-
Slicing
-
Plot candle sticks
-
Realistic random quotes
- Ticker 'pseudo' generates (not so realistic) data without real quotes dependence (good for tests)
-
Distinct kinds of quotes: Real, Realistic random, Synthetic Random
-
Cacheable and identified by hash of args
-
Real (market quotes)
-
Realistic (realistic random quotes, .i.e, it is based on real quotes)
-
Synthetic (quotes based interily on Gaussian distributions from pseudo random number generator)
- Lazy/Infinite
-
-
News fetching
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rndqts-0.2101.27.tar.gz
.
File metadata
- Download URL: rndqts-0.2101.27.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d933bd2948d8fb1ed1e662ef1c1ee4f3377c1f5c717edadbc04b79b63b8ec69 |
|
MD5 | 07603537536dbe642ae4018461cd138e |
|
BLAKE2b-256 | 7fc61ddda95c67eac4f5118f872d18d2b4eafd843ff696ee00fac623dc97f42b |
File details
Details for the file rndqts-0.2101.27-py3-none-any.whl
.
File metadata
- Download URL: rndqts-0.2101.27-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8e6f877b2f475d799b0d418d5c684c3460740f81755c9583229cbce115c83d0 |
|
MD5 | 65ecc6d5a58f388471492f38c5bbbaa0 |
|
BLAKE2b-256 | e89d604219b4ff9237c53772af92a0094c19b4fd8e43fd66a1e9dd7bd0ce85ea |