Skip to main content

This is for reading and writing stock data

Data storage

-path
--files
    filename_20180102.csv
    filename_20180103.csv
    .
    .
    .
    filename_20181231.csv

This new version package (still under construction) would also support data stored like below

-path
--files
    filename_A.csv
    filename_B.csv
    .
    .
    .

Read csv with different structures

  • example1

ticker1,value1
ticker2,value2
ticker3,value3
ticker4,value4

to read this type of csv file, use

read_df(path='path',file_pattern='filename')
  • example2

stkid,open,high,low,close
ticker1,o1,h1,l1,c1
ticker2,o2,h2,l2,c2
ticker3,o3,h3,l3,c3

to read open, use

Open=read_df(path='path',file_pattern='filename',dat_col='open')

to read open and close, use

Open,Close=read_df(path='path',file_pattern='filename',dat_col=['open','close'])

to return a multi index dataframe, use

Price=read_mdf(path='path',file_pattern='filename',dat_col=['open','close'])

Write

  • dataframe example

            ticker1     ticker2     ticker3
20180101     10.32       20.22        12.35
20180102      NaN        20.10        13.31
20180105      NaN        20.10        12.12

use write_df to write data of each date to one csv file

  • dictionary example

each value in the dictionary should be a dataframe and be like the example showed above

write_factors(path='path',file_pattern='filename',**dictionary)

Notice

Default reading trading calendar is Chinese market trading calendar, to change the calendar use dt_range option to input all dates.

Metadata

Release files for RNWS 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RNWS 0.2.1
File Size Uploaded
RNWS-0.2.1.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for RNWS 0.2.1
File Interpreter ABI Platform
RNWS-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / RNWS-0.2.1.tar.gz

Download URL RNWS-0.2.1.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c25268a8d004dc67f636a5c0f2c495b0ed6f0b88b421b45396998aa1800ae4c3
BLAKE2b-256 checksum
How to use checksums
652e3478c644194e5604525f1ad5ad8395a04a73e7285a149418c1cd9ae7d38e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.14.2 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.5

Release files / RNWS-0.2.1-py3-none-any.whl

Download URL RNWS-0.2.1-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3516c3f82499eb093da358db592cedee828872a1fd62f9cef5f28a365da31284
BLAKE2b-256 checksum
How to use checksums
a0ebd17504508718c4f5e100314d1a285911929e421adc724d02a58152cb5167
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.14.2 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.5

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

1 release file

0.1.3

1 release file

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page