Skip to main content

Random stock quotes generator based on real data distribution

Project description

test codecov

rndqts

Random stock market quotes

Installation

from package

# Set up a virtualenv. 
python3 -m venv venv
source venv/bin/activate

# Install from PyPI
pip install rndqts

from source

cd my-project
git clone https://github.com/davips/rndqts ../rndqts
pip install -e ../rndqts

Examples

Fetching from Yahoo

from rndqts.quotes import Quotes

print(Quotes("PETR4.sa", progress=False).data)
"""
                 Open       High        Low      Close        Volume
Date                                                                
2000-01-03   4.050103   4.050103   4.050103   4.050103  3.538944e+10
2000-01-04   3.826055   3.826055   3.826055   3.826055  2.886144e+10
2000-01-05   3.787450   3.787450   3.787450   3.787450  4.303360e+10
2000-01-06   3.774351   3.774351   3.774351   3.774351  3.405568e+10
2000-01-07   3.791586   3.791586   3.791586   3.791586  2.091264e+10
...               ...        ...        ...        ...           ...
2021-01-04  28.650000  29.180000  28.530001  28.910000  7.471970e+07
2021-01-05  28.900000  30.180000  28.240000  30.040001  9.518110e+07
2021-01-06  30.160000  30.900000  30.049999  30.100000  9.656250e+07
2021-01-07  30.340000  31.150000  30.340000  31.000000  5.617130e+07
2021-01-08  31.459999  31.760000  30.350000  31.120001  6.713630e+07

[5171 rows x 5 columns]

"""

Random stock quotes

from rndqts.quotes import Quotes

# Caching real quotes from Yahoo.
Quotes("PETR4.sa", progress=False).data
Quotes("VALE3.sa", progress=False).data
Quotes("CSNA3.sa", progress=False).data
Quotes("USIM5.sa", progress=False).data

# Generating random quotes.
print(Quotes("rnd", seed=42).data)
"""
            Open       High        Low      Close    Volume
Date                                                       
0       1.009476   1.016327   1.000685   1.005481         3
1       1.033090   1.020436   1.052670   1.034923         9
2       1.047446   1.031400   1.061204   1.038470        21
3       1.076301   1.066904   1.117921   1.115601        45
4       1.120012   1.109232   1.140871   1.134210        93
...          ...        ...        ...        ...       ...
36503  48.629245  50.269727  48.066787  48.805014  59063774
36504  47.470540  48.686514  47.159761  47.968600  59063776
36505  48.003956  47.530923  48.003956  47.539597  78190333
36506  46.767703  47.331148  46.531048  46.531048  78190335
36507  47.136037  47.136037  45.986474  46.894101  57379674

[36508 rows x 5 columns]

"""
"""

"""

Saving as a CSV file

from rndqts.quotes import Quotes

Quotes("PETR4.sa", progress=False).data.to_csv("/tmp/myfile.csv")


"""

"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rndqts-0.2101.7.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

rndqts-0.2101.7-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file rndqts-0.2101.7.tar.gz.

File metadata

  • Download URL: rndqts-0.2101.7.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.1

File hashes

Hashes for rndqts-0.2101.7.tar.gz
Algorithm Hash digest
SHA256 f99640c807dc68587fc8db905cff971c22f346c0432b25646184eaa83cfca166
MD5 5f36983dc4f66e953863d992daffcb67
BLAKE2b-256 1e4a4ac14f1ca88f56cb9bbdb7aad051416716c28dee16285b5ba04612c54b8a

See more details on using hashes here.

File details

Details for the file rndqts-0.2101.7-py3-none-any.whl.

File metadata

  • Download URL: rndqts-0.2101.7-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.1

File hashes

Hashes for rndqts-0.2101.7-py3-none-any.whl
Algorithm Hash digest
SHA256 94895bc34842fcfc70fe6f54e5cc99126581a1e5bc48155f6dfba434080d3987
MD5 37171d7eb677de6b0a94fb4cb506f978
BLAKE2b-256 633a5dbe643fcaa4be90322eeb10e9c13a6aa5a05e151765f2be5820ad8b8094

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page