Skip to main content

generate alpha factors

Project description


from alpha_factory import generator_class
from RNWS import read
import numpy as np
import pandas as pd

factor_path='.'
frame_path='.'

df=pd.read_csv(frame_path+'/frames.csv')

exr=read.read_df(r'.\exr',file_pattern='exr',start=20160101,end=20170201)
cap=read.read_df(r'.\cap',file_pattern='cap',header=0,dat_col='cap',start=20160101,end=20170201)
open_price,close,vwap,high,low,volume=read.read_df(r'.\mkt_data',file_pattern='mkt',start=20160101,end=20170201,header=0,dat_col=['open','close','vwap','high','low','volume'])
ind1,ind2,ind3=read.read_df(r'.\ind',file_pattern='ind',start=20160101,end=20170201,header=0,dat_col=['level1','level2','level3'])

parms={'exr':exr
,'cap':cap
,'open_price':open_price
,'close':close
,'vwap':vwap
,'high':high
,'low':low
,'volume':volume
,'ind1':ind1
,'ind2':ind2
,'ind3':ind3}

# generate starting:
gc=generator_class(df,factor_path,**parms)
gc.generator(batch_size=3)
gc.generator(batch_size=3)
gc.output_df(path=frame_path+'/frames_new.csv')

# generate continue:
with generator_class(df,factor_path,**parms) as gc:
gc.reload_df(path=frame_path+'/frames_new.csv')
gc.reload_factors()
gc.generator(batch_size=2)
gc.output_df(path=frame_path+'/frames_new2.csv')

# multiprocessing
if __name__=='__main__':
with generator_class(df,factor_path,**parms) as gc:
gc.reload_df(path=frame_path+'/frames_new.csv')
gc.reload_factors()
gc.generator(batch_size=5)
gc.generator(batch_size=10,multi=True,processors=3)
gc.generator(batch_size=10,multi=True,processors=3)
gc.output_df(path=frame_path+'/frames_new.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

alpha_factory-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

alpha_factory-0.1.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file alpha_factory-0.1.1.tar.gz.

File metadata

  • Download URL: alpha_factory-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for alpha_factory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f2549bba2464bfc9721b9f0551bf6c4271f6ea150b7060af97e395517017cec4
MD5 bda378d536ff1c99247f150864617863
BLAKE2b-256 00d43e8778234f4b6f0629979277b4f2a9f2facbd8caaa065f0ca3234c8e1b62

See more details on using hashes here.

File details

Details for the file alpha_factory-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for alpha_factory-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 201754d27112748b072f898251f98ba6c0c13b795b89bfffa89870b5f4cc55aa
MD5 0c102f6c108c17fe706eb65582539dff
BLAKE2b-256 5b79db58ddd33c6df7861bf30777a680dd424091368f3bd7196cf3d1043c2837

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