Skip to main content

numin package

Project description

numin2 Package

numin2 is a Python package designed for algorithmic trading and backtesting providing an API called Numin2API.

numin (v1) is a different package!!

numin2 is under development; features available are documented below

Features

  • Data Retrieval: Download training, round, and validation data.
  • Prediction Submission: TBD
  • Real-Time Round Management: TBD
  • Backtesting: Backtesting cross-sectional predictions vs targets for Nifty50
  • File Management: TBD
  • Returns Summary: TBD

Supported Methods

  • Data Download:

    • Numin2API().get_data_for_month(self,year,month,batch_size=4,window_size=100,target_type='rank'):

    • Returns batches of sequences (lists) for the given year and month of Nifty 50 or n returns

    • Dimension of each sequence is window,n. Returns NuminDataset of shape batch_size,window_size,n for features. Default n=50. (Later n will be a parameter).

    • Targets are next day returns / ranked returns of shape batch_size,n

    • Numin2API().download_data(outfile,type='daily',features='returns')

    • Download data for a given type and features

    • type can be 'daily','intraday'

    • features can be 'returns' (close returns),'open_close' (open-close returns), or 'ohlcv'

    • outfile is the name of the parquet file to save the data

    • get_range_dataloader(data_path: str, start_year: int, start_month: int, end_year: int, end_month: int, batch_size: int = 32, window_size: int = 100, target_type: str = 'raw', top_k: int = 10)

    • Returns a torch dataloader for the given range of years and months of Nifty 50 or n returns

    • Dimension of each day is window,n. Returns tensor of shape batch_size,window_size,n for features. Default n=50. (Later n will be a parameter).

    • Targets are next day returns / ranked returns of shape batch_size,n

    • get_dataloader(data_path: str, batch_size: int = 32, window_size: int = 100, target_type: str = 'raw', top_k: int = 10)

    • Returns a torch dataloader for the given range of years and months of Nifty 50 or n returns

    • Dimension of each day is window,n. Returns tensor of shape batch_size,window_size,n for features. Default n=50. (Later n will be a parameter).

    • Targets are next day returns / ranked returns of shape batch_size,n

    • Numin2API()fetch_intraday_raw_data(delta=50,features='returns')

    • fetches current intraday data given delta time in minutes before current time

    • returns dataframe that can be appended to the consolidated data file or used in memory

    • features can be returns or ohlcv

  • Backytesting

    • backtest_positions(positions,targets,txn_costs=.9)
    • backtest_positions(positions,targets,txn_costs=.1)
    • Takes a batch of positions for 50 stocks
    • Each position is a list of length 51, 0 position for cash, rest interpreted as weight with which capital is allocated. So 1 0 0 0 .. means no positions all cash. Sum must be non-zero.
    • Targets are returns (real numbers) for each of these stocks ove the batch.
    • Returns a dict such as {'daily_pnl','total_profit','sharpe_ratio,'mean_daily_return'}

Installation

Install numin2 using pip:

pip install numin2

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

numin2-1.0.10.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numin2-1.0.10-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file numin2-1.0.10.tar.gz.

File metadata

  • Download URL: numin2-1.0.10.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for numin2-1.0.10.tar.gz
Algorithm Hash digest
SHA256 a4432564c0d6601e7dedfbbe7c0a39b9885c5870f105be69c649e1fc70d5e5b5
MD5 e643ca828541f68e374ffcd21d8f35b2
BLAKE2b-256 d5bfd3c499ce07f6dfb6fce953a33795f942cef78578a8fa7ad0a172f4e70698

See more details on using hashes here.

File details

Details for the file numin2-1.0.10-py3-none-any.whl.

File metadata

  • Download URL: numin2-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for numin2-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 2faaa526afc33d7ab2f820c0deb46c7a8f59e2dfd0c8c2e369fcd2c3921e0017
MD5 f7811fbe291b5f363593d720df1a448a
BLAKE2b-256 9e0c17bb2db75610586c56d78230dd591db9449796da5791e72b3e7301099a34

See more details on using hashes here.

Supported by

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