Saravanan666/pypi-org huggingface dataset:
Package: quantregCF
QuantregCFThis Python package is an implementation of the control function approach for quantile regression models proposed by Sokbae Lee in "Endogeneity in Quantile Regression Models: A Control Function Approach,"Journal of Econometrics, 141: 1131-1158, 2007.InstallationThis project can be installed using pip:pipinstallquantregCFUsagefromquantregCFimportquantregCFbeta,se=quantregCF(option,degree,tau_first_stage,tau_second_stage,data)quantregCFreturns a list of estimated coefficients and a list of standard errors.ParametersThe main function isquantregCF(option,degree,tau_first_stage,tau_second_stage,data)option= 0 if the second-stage quantile regression uses polynomial series.option= 1 if the second-stage quantile regression uses B-spline.degreeis the degree of the polynomial/B-spline. (integer)tau_first_stageis the value of tau for the first-stage quantile regression. (between 0 and 1)tau_second_stageis the value of tau for the second-stage quantile regression. (between 0 and 1)datais a list of length two that contains information on the dataset.data=[`dataframe`,`var_lst`]Each element indatais defined as followed:dataframeis the dataset in the pandas DataFrame format.var_lstis a list of length four that contains the name of variables of interest. The first two elements ofvar_lstare strings and the last two elements are lists of strings.`var_lst`=[`dep_var`,`endog_var`,`exog_var_lst`,`iv_var_lst`]Each element invar_lstis defined as followed:dep_varandendog_varare the names of dependent variable and endogenous right-hand side variable.exog_var_lstandiv_var_lstare the lists of names of exogenous included variables and instrumental variables.ExampleThe filefishdata.pyillustrates how to usequantregCFon the well-known Graddy’s Fulton fish market data. To run the code, simply downloadfishdata.pyfrom thetestsfolder and runpython fishdata.py. Below is a code snippet showing how to load the data and usequantregCF.# load data into DataFrame `df` from https://www.kathryngraddy.org/research#pubdatadata_source="https://uploads-ssl.webflow.com/629e460595fdd36617348189/62a0fd19b6742078eed59f47_fish.out.txt"df=pd.read_csv(data_source,sep="\t")var_lst=['qty','price',["day1","day2","day3","day4"],["stormy","mixed"]]data_lst=[df,var_lst]# regressions using B-splines in the second-stagebeta,se=quantregCF(option=1,degree=3,tau_first_stage=0.5,tau_second_stage=0.5,data=data_lst)# calculate the 95% confidence intervalci_lb=beta[0]-1.96*se[0]ci_ub=beta[0]+1.96*se[0]DependenciesNumPyPandasSciPyCVXPYUrllib
Package: quant-risk
RiskWelcome to the Quant-Risk package!Please head over tohttps://quant-risk.readthedocs.io/en/latest/to view the latest documentation for the packageTo set up your environment:install pipenv by:pip install pipenvthen go to the main directory of this repo and do:pipenv shellUpdate your setup tools package by:python -m pip install -U pip setuptoolsNow, to install the package, run the command:pipenv install quant_riskTo exit the virtual environment do:exitSince, PyPortfolioOpt requires  Visual Studio C++, do the following:Before installing and setting up your environment, install Visual Studio Build Tools from here:https://visualstudio.microsoft.com/downloads/choose the Community version if you have WindowsFrom the available softwares, select "Visual Studio Build Tools 2019"Now your pipenv shell should be able to install PyPortfolioOptNote: The above is for Windows users, for Mac users please see:https://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/To run a jupyter notebook instance with this venv:Activate your venv by:pipenv shellrun the command:pipenv install jupyterrun the command:pipenv run jupyter notebookAll done!
An instance of Jupyter notebook should now open up in your browserVersion 1.1.1Fixed minor import errorsVersion 1.1.0Added risk parity portfolios and covariance shrinkageVersion 1.0.2Removed Quandl dependency and risk free rate functionVersion 1.0.1First published working buildVersion 1.0.0Initial Build
Package: quantrocket-utils
QuantRocket Utility LibraryUtility methods for common tasks in QuantRocket.Installationquantrocket-utilscan be installed viapip:$pipinstallquantrocket-utilsDevelopmentThis project usespoetryfor development and release management.$ git clone git@github.com:boosting-alpha-bv/quantrocket-utils.git
$ cd quantrocket-utils/
$ poetry installRunning Tests$poetryruncoveragerun--branch--sourcequantrocket_utils-mpytestGenerating Coverage Reports$poetryruncoveragehtmlRunning flake8$poetryrunflake8quantrocket_utilstestsDeploying$poetrypublish--build--username"${PYPI_USERNAME}"--password"${PYPI_PASSWORD}"--no-interactionUsageThis library requires an external file that contains the listing information for the stocks it should translate.
This is typically exported from QuantRocket and then supplied at initialization time of the library.
Work is currently under way to remove the dependency on QuantRocket for obtaining this listings file.# Import the library and initialize the ConID resolutionfromquantrocket_utilsimportinitializeasassets_init,Assetassets_init("<path>/<to>/listings.csv")# Create an Asset using the symbol namespy=Asset("SPY")# The exchange is optional, unless two symbols of the same name exist on different exchangesspy=Asset("SPY","ARCA")# Create an Asset using the ConID# In this case the exchange can be inferred from the ConID, so it is always otpionalspy=Asset(756733)# ConID's can be strings as well, so don't worry about type conversionspy=Asset("756733")# Access data on the objectspy.conid>>756733spy.symbol>>"SPY"spy.exchange>>"ARCA"# Check trading timesspy.can_trade("2019-03-04","10:34:02")>>True# Assets also support equality and comparison operations based on the ConID# However, this is mostly just useful for guaranteeing sorting order# Assets are also hashable and can thus be utilized in set operationsAsset("SPY")<Asset("AAPL")>>True
Package: quants
quants packagePackage for Artifical Neural Network (ANN) based learning of quantifiers.It contains definition of scenes of elements and classes for both quantifier sampling and NN simple example package.ClassesQuantifer classesThese classes are a quantifier hierarchy with methods and definitions for:Scenesthat are composed of worldelementspertaining to use of a sentence of the form "q as are bs".Construction of quantifier if parameters (such as in the case of ExactlyN for instance) are required.Static method for generation of a completely random scene.Generation of permuted prototype scenes that are evaluated as true under the given quantifier q.Evaluation of a given scene (returnsTRUEfor scenes generated by the same quantifier q in the previous method).Classifier class approachThis approach assumes that quantifiers are learned as a group, essentially each quantifier qTRUEsceneis a negative example for all other quantifiers q'.
There is of course many scenes for which more than one quantifier is evaluated asTRUE, for instance if "Both students are eating" isTRUEthen "Some students are eating" is alsoTRUE, this can be mitigated by implicatures which we do not address.The classifier is in effect a solver for which q makes the sentence "q as are bs" most likely given an inputscenes.This enables us to use not only the quantifier quantify evaluation methods but the classifier in order to generate a teacher-student scheme.AE approachThe AE approach tries to let an AE look atsceneswhere a given quantifier q was used by a teacher (language speaker), this is repeated many times till whatever structure typical to scenesTRUEunder the quantifier q are encoded in the AE hidden values' represented structure. When learning is complete and when we are given a scene we use the AE as an anomaly detector to decide whether the scene is True under the quantifier q. The idea is that after seeing many qTRUEscenes a non qTRUEscene will have relatively high reconstruction errors.
Package: quantscripts
# Financial Analysis ScriptsThis repository contains a collection of Python scripts for financial analysis. The scripts cover various aspects such as Cointegration Testing, Duration Calculation, and Statistical Features computation.## Scripts### CointegrationTestTheCointegrationTestscript is designed for conducting cointegration tests on financial time series data. Cointegration is a statistical property that allows two or more time series to move together over time. This script provides functionalities for performing cointegration tests and analyzing the results.### DurationTheDurationscript focuses on calculating the duration of financial instruments. Duration is a measure of the sensitivity of the price of a bond or other debt instrument to a change in interest rates. This script allows users to compute the duration of financial instruments based on given parameters.### StatisticalFeaturesTheStatisticalFeaturesscript is dedicated to computing various statistical features of financial datasets. This includes measures such as mean, standard deviation, skewness, and kurtosis. These statistical features provide insights into the distribution and characteristics of the data.## UsageTo use these scripts, follow these general steps:git clonehttps://github.com/tonyyang1223/quantscripts.gitcd quantscripts## Build
setup.py sdist bdist_wheel
twine upload dist/*
Package: quant-sdk
The Quant SDK is a python-wrapper for the Cryptocurrency trading API of Blocksize Capital.
It is a Python interface fully integrated with Blocksize CORE™.
It enables the automation of algorithmic trading strategies, as well as accessing historical market data.
For requesting a (required) account please contact us viahttps://blocksize-capital.com/contact/The core part of the Quant SDK is the ability to automate trading strategies.
The potential applications of strategies are vast:
while simple portfolio rebalancing mechanisms can be implemented,
higher-frequency quantitative strategies may be deployed as well.
The Quant SDK can be installed in the terminal as follows:pip install quant-sdkTo use the Quant SDK, you need to authenticate yourself using your personalized Blocksize CORE™ API-Token.
A Blocksize CORE™ API-Token can be generated in the Blocksize MATRIX™ API Token Settings.
The Quant SDK can be used to trade on all of our connected exchanges which can be found on our Matrix dashboard.Check outexamples/client.pyto see an example of each of the clients functions.
Package: quantsight
This is a Python client for the Quantsight Data API, which allows you to fetch historical funding rates, candle data, and perform custom queries from supported exchanges. The client is easy to use and supports fetching data into a Pandas DataFrame for further analysis.Key features:✅ Pull data from API directly as a pandas DataFrame✅ Automatically cached data for faster retrieval and saved credits✅ Integrated OpenAI for querying data using natural language promptsInstallationTo install the Quantsight Data API Python client, usepip:pipinstallquantsightUsageFirst, import theQuantsightDataAPIclass and create an instance with your API key:importquantsightasqsapi_key="your_api_key"qs=qs.Quantsight(api_key)Then, you can use the following methods to fetch data from the Quantsight Data API:Get funding rateTo fetch historical funding rates from a supported exchange, use theget_funding_ratemethod:funding_rate_df=qs.get_funding_rate(exchange="okx",limit=1e6,)Get OHLCV dataTo fetch candle data from a supported exchange, use theget_ohlcvmethod:ohlcv_df=qs.get_ohlcv(period="1d",exchange="okx",limit=1e6,)Get OHLCV data around timeTo fetch candle data around a specific point in time, use theget_ohlcv_around_timemethod:ohlcv_around_time_df=qs.get_ohlcv_around_time(period="1d",exchange="okx",target_time=time(9,0,0),sample_count=10,limit=1e6,)Endpoint is useful for execution optimisation or seasonality analysisCustom query (BETA)To perform a custom query, use thecustom_querymethod:custom_query_df=qs.custom_query("SELECT close FROM {{okx.ohlcv.swap.1d}} LIMIT 10",dry_run=True,use_legacy_sql=False)Each method returns a Pandas DataFrame containing the fetched data.CachingQueries are cached both in BigQuery and on the client side in order to maximise your data allowance.By default the local cache location is stored next to the clien.py file but you may change it when initialising the
client:qs=qs.Quantsight(api_key=api_key,cache_path=Path("root/your/custom/cache/location"))You can retrieve cache metadata like so:qs.read_cache_metadata()You can delete all cache like so:qs.clear_cache()Pandas cache is handled by thedata-cachelibrary.DocumentationThe documentation for each endpoints can be found here:https://api.quantsight.dev/docsLicenseThis project is licensed under the MIT License. See theGNU GENERAL PUBLIC LICENSEfile for details.
Package: quantspace
quantspaceis a Python library designed specifically for quantitative finance, with a primary focus on supporting research and education in the field.Risk ManagementPortfolio OptimizationAnomaly DetectionFeatures1.Quantitative Research Toolsquantspaceoffers a comprehensive set of tools for conducting quantitative research in finance. From statistical analysis to advanced modeling techniques, the library provides the building blocks for developing and testing sophisticated financial strategies.2.Educational ResourcesDesigned with education in mind,quantspaceincludes resources and examples to help users understand and apply quantitative finance concepts. The library serves as a valuable resource for students, providing hands-on experience with real-world financial data and models.3.Data Integrationquantspaceseamlessly integrates with popular financial data sources, allowing users to access and analyze real-time and historical market data. This feature enhances the library's capabilities for both research and educational purposes.4.Flexibility and CustomizationThe library is designed to be flexible and customizable, accommodating a wide range of financial modeling requirements. Whether you are developing algorithms for risk management, portfolio optimization, or derivative pricing,quantspaceprovides a robust foundation for implementation.Getting StartedTo get started withquantspace, follow these simple steps:Installation:pip install quantspaceGetting Started:Risk measure:fromquantspace.riskimportsummary_riskreturns=[0.065,0.0265,-0.0593,-0.001,0.0346]summary_risk(returns=returns,risk_free_rate=0.05)Portfolio optimization:fromquantspace.utils.datasetsimportrandom_portfoliofromquantspace.portfolioimportMarkowitzFrontierimportnumpyasnpnp.random.seed(1234)n_assets=5# number of assets in portfolion_obs=1000# number of observations in datareturn_vec=np.random.randn(n_assets,n_obs)# generate random returns for each assetn_portfolios=500# number of portfolios to simulatemeans,stds=np.column_stack([random_portfolio(return_vec)for_inrange(n_portfolios)])# instantiate MarkowitzFrontier classm_frontier=MarkowitzFrontier(return_vec,stds,means)# plot efficient frontierm_frontier.plot_frontier()ContributionsWe welcome contributions from the community to enhance and expandquantspace. If you have ideas for new features, improvements, or find any issues, please feel free to contribute by submitting a pull request or opening an issue on our GitHub repository.Support and CommunityFor support or to connect with other users and contributors, join our community forums. We encourage discussions, knowledge sharing, and collaboration within thequantspacecommunity.Licensequantspaceis released under theMIT License, making it open and accessible for a wide range of users.Disclaimerquantspaceis provided "as is" without any warranty, express or implied. Use it at your own risk, and carefully review and test any code before deploying it in a production environment.Happy quantifying withquantspace!
Package: quantstyles
QuantstylesA set of slightly customized colormaps and styles, developed for internal use by Quantum Technology research group in the University of Rostock.It includes the set of colormaps + custom matplotlib style.UsageImport the package in your scriptimport quantstylesPackage automatically exports all the colormaps, i.e. they could be normally used by their names, e.g.plt.show(data, cmap="quantjet")Custom matplotlib style will be registered during first import of the package. It can be then activated asplt.style.use("quant")InstallationThe package is published on pypi, so it is enough to run:pip install quantstylesManual installation# clone the repogitclonehttps://github.com/Trel725/quantstyles.git--recursive# build the wheelmake# manually install the built packagepipinstalldist/quantstyles-*-py3-none-any.whlAcknoledgementsThis project depends onBeautiful package for generating perceptually uniform colormapsby Peter Kovesi. The heart of this small project is just a small modification of original Julia code.get-cpt script that allows efficient export of generated colormaps to Python.DevelopmentIf you'd like to manually go through all the steps:Clone the repo bygit clone https://github.com/Trel725/quantstyles.git --recursiveRecursive is needed to sync get-cpt repo.Generate colormaps by executing Julia code in colormaps foldercd colormaps
julia colormaps.jlPerceptualColourMaps.jl and PyPlot.jl need to be installed. See that code for more details, or just use pre-generated colormaps in the colormaps directory.3. Generate Python representation of the colormaps by runningpython generate_quantcmaps.py. This will produce actual file containing colormaps, quantcmaps.py  The command requires numpy, os, glob and (probably) urllib (from get-cpt).
4. Import quantcmaps in your script. All the listed colormaps will be available as usual, e.g.plt.imshow(data, cmap="quantjet")5. Custom style need to be copied to the matplotlib config dir. Seeofficial manualsfor details.6. Additionally you can try to build pip wheel by executingmakein the project top directory.0.01Initial release, includesColormaps generationPackaging0.100Piblished on PyPI0.101-0.103Bug fixes0.104Added custom MPL style and its installer0.105Switched to sans-serif fonts according to Nature recommendationsCorrected font size for the same reason0.106-0.107Bug fixes
Package: quant-trade-framework
GeneralQuantTradeClient通用量化交易框架客户端，用户获取平台数据#20191129创建初始版本#20191130增加bar数据获取接口
(1)初始化数据库连接配置,以下是标准配置，直接使用源代码，配置文件在conf目录下
database_manager = initialize.init(setting.SETTINGS)
(2) database_manager.load_bar_data 获取bar数据接口，包含五个参数
symbol: str 合约名称，比如"M9999.XDCE"
exchange: str,交易所，默认使用"test""
interval: str,bar数据聚合时间，目前只有"1m"
start: datetime, 查询开始时间，时间格式符合"2019-11-07 09:00:00"这种格式
end: datetime, 查询结束时间，时间格式符合"2019-11-07 09:00:00"这种格式
数据接口返回panda.dataframe对象0.1.2
对程序代码进行完善，增加代码注释
sphinx使用方法：
(1) python源代码自动生成rst,使用命令：
sphinx-apidoc.exe -o rst ..sphinx-apidoc -o [生成rst的位置] [项目代码的位置] -f(强制重新覆盖写，否则会检测，如果有同名文件存在，会跳过不更新)
sphinx-apidoc -o rst ../src
Package: quanttrader
quanttraderWelcome to quanttrader, a pure python-based event-driven backtest and live trading package for quant traders.The source code is completely open-sourcedhere on GitHub. The package is publishedhere on pypiand is ready to be pip installed. The document is hostedhere on readthedocs.In most cases, a backtest strategy can be directly used for live trade by simply switching to live brokerage. A control window is provided to monitor live trading sessions for each strategy separately and the portfolio as a whole.BacktestBacktest code structureBacktests examplesLive tradingLive Trading demo videoLive Trading code structurePrerequisite: download and install IB TWS or IB Gateway; enable API connection as describedhere.InstallationStep 1pipinstallquanttraderAlternatively, download or git the source code and include unzipped path in PYTHONPATH environment variable.step 2Downloadlive_engine.py,config_live.yaml,order_per_interval_strategy.pyby clicking Raw button, right clicking save as, and then change the file extension to .py or .yaml.step 3cdwhere_the_files_are_saved
pythonlive_engine.pyInstruments Supported and ExampleStock: AMZN STK SMARTForeign Exchange: EURGBP CASH IDEALPROFutures: ESM9 FUT GLOBEXOptions on Stock: AAPL OPT 20201016 128.75 C SMARTOptions on Futures: ES FOP 20200911 3450 C 50 GLOBEXComdty: XAUUSD CMDTY SMARTOrder Type SupportedBasic order types. SeeIB Docfor details.AuctionAuction LimitMarketMarket If TouchedMarket On CloseMarket On OpenMarket to LimitLimit OrderLimit if TouchedLimit on CloseLimit on OpenStopStop LimitTrailing StopTrailing Stop LimitDISCLAIMEROpen source, free to use, free to contribute, use at own risk. No promise of future profits nor responsibility of future loses.
Package: quantuloop-quest
QuEST interface for the Ket Quantum Programming LanguageThis package provides the Quantuloop interface for QuEST, a open-source GPU accelerated quantum simulator, as a quantum execution target for the quantum programming language Ket. For more information on Ket, please visithttps://quantumket.org.Please note that the use of this simulator is exclusively for Quantuloop's customers and partners. To obtain your access token, please contact your institution or visithttps://quantuloop.com.CompatibilityThe following system requirements are necessary to run the Quantuloop QuEST simulator:CUDA 11.2 or newer with compatible NVIDIA driverNVIDIA GPU with CUDA architecture >= 3.5Linux X86_64 with glibc >= 2.17Ubuntu 18.04 or newer.Red Hat Enterprise Linux 7 or newer.Python 3.7 or newerKet 0.5.xUsageTo use Quantuloop QuEST, importquantuloop_questand set it as the quantum target execution:fromketimport*fromquantuloop_questquantuloop_quest.set_simulator(token='YOUR,ACCESS.TOKEN',)By installing or using this package, you agree to the Quantuloop Quantum Simulator Suite EULA.All rights reserved (C) 2023 Quantuloop