kandi background
Explore Kits

qlib | oriented quantitative investment | Cryptocurrency library

 by   microsoft Python Version: v0.8.4 License: MIT

 by   microsoft Python Version: v0.8.4 License: MIT

Download this library from

kandi X-RAY | qlib Summary

qlib is a Python library typically used in Blockchain, Cryptocurrency applications. qlib has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install qlib' or download it from GitHub, PyPI.
The detailed documents are organized in docs. Sphinx and the readthedocs theme is required to build the documentation in html formats. You can also view the latest document online directly. Qlib is in active and continuing development. Our plan is in the roadmap, which is managed as a github project.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • qlib has a medium active ecosystem.
  • It has 8313 star(s) with 1466 fork(s). There are 227 watchers for this library.
  • There were 6 major release(s) in the last 12 months.
  • There are 152 open issues and 362 have been closed. On average issues are closed in 66 days. There are 12 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of qlib is v0.8.4
qlib Support
Best in #Cryptocurrency
Average in #Cryptocurrency
qlib Support
Best in #Cryptocurrency
Average in #Cryptocurrency

quality kandi Quality

  • qlib has 0 bugs and 0 code smells.
qlib Quality
Best in #Cryptocurrency
Average in #Cryptocurrency
qlib Quality
Best in #Cryptocurrency
Average in #Cryptocurrency

securitySecurity

  • qlib has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • qlib code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
qlib Security
Best in #Cryptocurrency
Average in #Cryptocurrency
qlib Security
Best in #Cryptocurrency
Average in #Cryptocurrency

license License

  • qlib is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
qlib License
Best in #Cryptocurrency
Average in #Cryptocurrency
qlib License
Best in #Cryptocurrency
Average in #Cryptocurrency

buildReuse

  • qlib releases are available to install and integrate.
  • Deployable package is available in PyPI.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • qlib saves you 7200 person hours of effort in developing the same functionality from scratch.
  • It has 32078 lines of code, 2672 functions and 247 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
qlib Reuse
Best in #Cryptocurrency
Average in #Cryptocurrency
qlib Reuse
Best in #Cryptocurrency
Average in #Cryptocurrency
Top functions reviewed by kandi - BETA

kandi has reviewed qlib and discovered the below as its top functions. This is intended to give you an instant insight into qlib implemented functionality, and help decide if they suit your requirements.

  • Build the base graph .
  • Parse the config into a list of field names .
  • Run the model .
  • Returns a list of figures showing the risk analysis .
  • Back test .
  • Perform a long - short back test .
  • Dump pitch data to a file .
  • Evaluate the risk function .
  • Resampling of ts data .
  • Calculate the plot figure .

qlib Key Features

Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment. With Qlib, you can easily try your ideas to create better Quant investment strategies. An increasing number of SOTA Quant research works/papers are released in Qlib.

Install with pip

copy iconCopydownload iconDownload
  pip install pyqlib

Install from source

copy iconCopydownload iconDownload
pip install numpy
pip install --upgrade  cython

Data Preparation

copy iconCopydownload iconDownload
# get 1d data
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn

# get 1min data
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min

Automatic update of daily frequency data (from yahoo finance)

copy iconCopydownload iconDownload
* * * * 1-5 python <script path> update_data_to_bin --qlib_data_1d_dir <user data dir>

Auto Quant Research Workflow

copy iconCopydownload iconDownload
  cd examples  # Avoid running program under the directory contains `qlib`
  qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml

Run multiple models

copy iconCopydownload iconDownload
python run_all_model.py run 10

More About Qlib

copy iconCopydownload iconDownload
cd docs/
conda install sphinx sphinx_rtd_theme -y
# Otherwise, you can install them with pip
# pip install sphinx sphinx_rtd_theme
make html

Set slaves for jupyterq

copy iconCopydownload iconDownload
$jupyter kernelspec list
  qpk        /Users/anaconda3/share/jupyter/kernels/qpk
 "env": {"JUPYTERQ_SERVERARGS":"","MPLBACKEND":"Agg"}

Changed to 

"env": {"JUPYTERQ_SERVERARGS":"-s 20","MPLBACKEND":"Agg"}
-----------------------
$jupyter kernelspec list
  qpk        /Users/anaconda3/share/jupyter/kernels/qpk
 "env": {"JUPYTERQ_SERVERARGS":"","MPLBACKEND":"Agg"}

Changed to 

"env": {"JUPYTERQ_SERVERARGS":"-s 20","MPLBACKEND":"Agg"}

SQL code for search option in a php web page

copy iconCopydownload iconDownload
SELECT * FROM book_description 
JOIN book_class ON book_class.series = book_description.series 
WHERE book_description.title LIKE "%'.$category.'%"'
and (or) book_description.author like "%'.$author.'%"'
... 
and so on

Regular expression doesn't produce expected result

copy iconCopydownload iconDownload
for i in s.split('\n'):
    number = re.findall(r'^\d+', i)
    if number: failure = re.findall(r'^(\d+)\.(.*?)\s_{2,}', i)
    if 'failed' in i:
        print(failure)
[('9', 'TX_MULTI_VERIFICATION 2412 DSSS-1 NON_HT BW-20 TX1')]
[('11', 'TX_MULTI_VERIFICATION 2472 DSSS-1 NON_HT BW-20 TX1')]
[('12', 'TX_MULTI_VERIFICATION 2412 CCK-11 NON_HT BW-20 TX1')]
-----------------------
for i in s.split('\n'):
    number = re.findall(r'^\d+', i)
    if number: failure = re.findall(r'^(\d+)\.(.*?)\s_{2,}', i)
    if 'failed' in i:
        print(failure)
[('9', 'TX_MULTI_VERIFICATION 2412 DSSS-1 NON_HT BW-20 TX1')]
[('11', 'TX_MULTI_VERIFICATION 2472 DSSS-1 NON_HT BW-20 TX1')]
[('12', 'TX_MULTI_VERIFICATION 2412 CCK-11 NON_HT BW-20 TX1')]
-----------------------
splitted = re.split(r'(\d{1,2})\.(.*)(?= _{3,})', text)

failed = [(splitted[i-2], splitted[i-1]) for i, s in enumerate(splitted) if re.search(r'\[failed\]', s)]

failed
# [('9', 'TX_MULTI_VERIFICATION 2412 DSSS-1 NON_HT BW-20 TX1'), 
#  ('11', 'TX_MULTI_VERIFICATION 2472 DSSS-1 NON_HT BW-20 TX1'), 
#  ('12', 'TX_MULTI_VERIFICATION 2412 CCK-11 NON_HT BW-20 TX1')]

Reading/writing a resultcode in Android

copy iconCopydownload iconDownload
@Override
public void onFinish() {
    Intent intent = new Intent();
    intent.putExtra("MY_SCORE", score);
    setResult(RESULT_OK, intent);
    finish();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1) {
        if(resultCode == RESULT_OK){
            int score = data.getIntExtra("MY_SCORE", -1);

            if (score > readHighscore()) {
                writeHighscore(resultCode);
            }
        }
    }
}
-----------------------
@Override
public void onFinish() {
    Intent intent = new Intent();
    intent.putExtra("MY_SCORE", score);
    setResult(RESULT_OK, intent);
    finish();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1) {
        if(resultCode == RESULT_OK){
            int score = data.getIntExtra("MY_SCORE", -1);

            if (score > readHighscore()) {
                writeHighscore(resultCode);
            }
        }
    }
}

Multiple Choice Quiz in Python: how to assign number labels to dictionary random.sample output

copy iconCopydownload iconDownload
Qlib = dict()
Qlib["Apple"]="green"
Qlib["Plum"]="purple"
Qlib["Banana"]="yellow"
Qlib["Strawberry"]="red"

def qshuffle():
    choices = random.sample(list(Qlib),4)
    random_fruit = random.choice(choices)
    print("Which fruit is of {0} colour??\n".format(Qlib[random_fruit]))
    print('--- Choices: ---\n' + "\n".join([x for x in Qlib]))
    answer = input("You answer is >> ")

    if answer.capitalize() == random_fruit:
        print("That's right")
    else:
        print("Sorry, wrong answer.")
-----------------------
import random

Qlib = dict()
Qlib["Apple"]="green"
Qlib["Orange"]="orange"
Qlib["Banana"]="yellow"
Qlib["Strawberry"]="red"

#defining options for further usage, optional but required in this code
letters = ["a","b","c","d"]

#I'm not sure about self in it
def Qshuffle(self):
    #I'm not sure this for x in range(1) is necessary
    for x in range(1):
        choices = random.sample(list(Qlib),4)
        random_fruit = random.choice(choices)
        main_typed = "Which fruit is the following colour...??\n\n\n"

        print('{0} {1}\n\n'.format(main_typed, random_fruit.center(85)))
        print('Choices:')
    #Defining/storing list of choices for further use, necessary
    options = list(Qlib[x] for x in choices)
    #some improvements of printing choices
    for i in range(len(options)):
        op = str(options[i])+" ["+str(letters[i])+"]"
        print(op.rjust(38))
    answer = input("Enter answer a,b,c, or d\n>>> ")

    if answer.lower() in letters:
        ########
        #Some debug information, can be deleted
        print("="*5)
        print(Qlib[random_fruit])                       #the color of random fruit
        print(letters.index(answer.lower()))            #index of selected answer
        print(options)                                  #list of options
        print(options[letters.index(answer.lower())])   #the color that user selected
        print("="*5)
        ########
        #checking that user chose the color of the random fruit
        if Qlib[random_fruit] == options[letters.index(answer.lower())]:
            print("correct")
        else:
            print("wrong")
    else:
        print("incorrect input")

Qshuffle("")

Community Discussions

Trending Discussions on qlib
  • Set slaves for jupyterq
  • SQL code for search option in a php web page
  • Regular expression doesn't produce expected result
  • Reading/writing a resultcode in Android
  • Multiple Choice Quiz in Python: how to assign number labels to dictionary random.sample output
Trending Discussions on qlib

QUESTION

Set slaves for jupyterq

Asked 2019-Aug-13 at 07:08

I am running Q in jupyter. To enable multiple slaves, jupyter requires to be run with parameter -s.

How can I launch a kernel in jupyerq with slaves enabled? I tried passing '-s 20' into argv here in the runkernel.py, but the kernel wouldn't start at all

 os.execvp('/bin/qlib/3.6.x86_64/q', ['/bin/qlib/3.6.x86_64/q', jupyterq_kernel.q', '-cds'] + argv)

ANSWER

Answered 2019-Aug-13 at 07:08

You can do this as follows:

  1. Find the location of your kernel.json file for qpk by running
$jupyter kernelspec list
  qpk        /Users/anaconda3/share/jupyter/kernels/qpk

Open the kernel.json file and modify the following line as outlined to set up the notebook to initialise 20 slaves threads on server startup

 "env": {"JUPYTERQ_SERVERARGS":"","MPLBACKEND":"Agg"}

Changed to 

"env": {"JUPYTERQ_SERVERARGS":"-s 20","MPLBACKEND":"Agg"}

For reference instructions for completing command line argument execution for jupyterq can be found here: https://code.kx.com/v2/ml/jupyterq/notebooks/#server-command-line-arguments

Source https://stackoverflow.com/questions/57469992

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install qlib

This quick start guide tries to demonstrate. Here is a quick demo shows how to install Qlib, and run LightGBM with qrun. But, please make sure you have already prepared the data following the instruction.
It's very easy to build a complete Quant research workflow and try your ideas with Qlib.
Though with public data and simple models, machine learning technologies work very well in practical Quant investment.
This table demonstrates the supported Python version of Qlib: | | install with pip | install from source | plot | | ------------- |:---------------------:|:--------------------:|:----:| | Python 3.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.8 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.9 | :x: | :heavy_check_mark: | :x: |.
Conda is suggested for managing your Python environment.
Please pay attention that installing cython in Python 3.6 will raise some error when installing Qlib from source. If users use Python 3.6 on their machines, it is recommended to upgrade Python to version 3.7 or use conda's Python to install Qlib from source.
For Python 3.9, Qlib supports running workflows such as training models, doing backtest and plot most of the related figures (those included in notebook). However, plotting for the model performance is not supported for now and we will fix this when the dependent packages are upgraded in the future.
QlibRequires tables package, hdf5 in tables does not support python3.9.
Users can easily install Qlib by pip according to the following command.
Also, users can install the latest dev version Qlib by the source code according to the following steps:. Tips: If you fail to install Qlib or run the examples in your environment, comparing your steps and the CI workflow may help you find the problem.
Before installing Qlib from source, users need to install some dependencies: pip install numpy pip install --upgrade cython
Clone the repository and install Qlib as follows. git clone https://github.com/microsoft/qlib.git && cd qlib pip install . Note: You can install Qlib with python setup.py install as well. But it is not the recommanded approach. It will skip pip and cause obscure problems. For example, only the command pip install . can overwrite the stable version installed by pip install pyqlib, while the command python setup.py install can't.

Support

Join IM discussion groups: |Gitter| |----| ||.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Reuse Pre-built Kits with qlib
Consider Popular Cryptocurrency Libraries
Compare Cryptocurrency Libraries with Highest Support
Compare Cryptocurrency Libraries with Highest Quality
Compare Cryptocurrency Libraries with Highest Security
Compare Cryptocurrency Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.