preface

After arrive now, I have been hurt by fund heart 🤕

Therefore, I plan to learn about quantitative trading in order to get rid of it.

To learn quantitative trading, I need to get the transaction data first. Here I use the local data interface provided by Jukuan Data. The Official Python SDK is provided, so I started to install the SDK according to the document…

Following the installation steps in the documentation, it is actually very simple:

$ pip install jqdatasdk
Copy the code

If all is well, then you can simply close this article.

But if your circumstances are anything like mine:

  • System Version:MacOS BigSur 11.2.3
  • Python version:3.9
  • IDE version:PyCharm Professional 2020.3

It is likely that the installation will fail and the error log is as follows (partial log) :

$ pip install jqdatasdkCollecting jqdatasDK-1.8.8-py3-none-any. WHL (151 kB) Requirement already satisfied: The six in/usr/local/lib/python3.9 / site - packages (from jqdatasdk) (1.15.0)... Requirement already satisfied: Urllib3 < 1.27 > = 1.21.1 in/usr/local/lib/python3.9 / site - packages (from requests - > jqdatasdk) (1.26.3) Building wheels for collected packages: thriftpy2 Building wheel for thriftpy2 (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/local/opt/[email protected]/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tx/_rv7b39127d289cpmm3dpylr0000gn/T/pip-install-p9oxcpjv/thriftpy2_42f75cad7b3842908525f1c376f 2eb3d/setup.py'"'"'; __file__='"'"'/private/var/folders/tx/_rv7b39127d289cpmm3dpylr0000gn/T/pip-install-p9oxcpjv/thriftpy2_42f75cad7b38429085 25f1c376f2eb3d/setup.py'"'"'; f=getattr(tokenize, '"'"'open'"'"', open)(__file__); code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"'); f.close(); exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/tx/_rv7b39127d289cpmm3dpylr0000gn/T/pip-wheel-vdjkejow cwd: /private/var/folders/tx/_rv7b39127d289cpmm3dpylr0000gn/T/pip-install-p9oxcpjv/thriftpy2_42f75cad7b3842908525f1c376f2eb3d / Complete output (93 lines): running bdist_wheel The [wheel] section is deprecated. Use [bdist_wheel] instead. ...... Macosx-11-x86_64-3.9 /thriftpy2/transport clang-wno-unused - result-wsign-compare creating build/temp. Macosx-11-x86_64-3.9 /thriftpy2/transport clang-wno-unused - result-wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot / Library/Developer/CommandLineTools/SDKs/MacOSX SDK -i/usr/local/include -i/usr/local/opt/[email protected] / include -I/usr/local/opt/sqlite/include -I/usr/local/opt/tcl-tk/include -i/usr/local/Cellar/[email protected]/3.9.2 _1 / Frameworks/Python framework Versions / 3.9 / include/python3.9 - c Thriftpy2 / transport/cybase. C - o build/temp macosx - 11 - x86_64-3.9 / thriftpy2 / transport/cybase. O clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11' error: command '/usr/bin/clang' failed with exit code 1 ----------------------------------------Copy the code

At this point, we can find the key information in the log:

clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11'
Copy the code

The solution

1. Check the clANG version of the current system

$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Copy the code

2. Check the system CommandLineTools version again

$ softwareupdate --all --install --force
Software Update Tool

Finding available software
No updates are available.
Copy the code

There is a hole, through softwareupdate found no, actually we use another tool to check

$ brew doctorPlease note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! . Warning: Your Command Line Tools (CLT) does not support macOS 11. It is either outdated or was modified. Please update your Command Line Tools (CLT) or delete it if no updates are available. Update them from Software Update in System Preferences or run: softwareupdate --all --install --force If that doesn't show you any updates, run: sudo rm -rf /Library/Developer/CommandLineTools sudo xcode-select --install Alternatively, manually download them from: https://developer.apple.com/download/more/.Copy the code

Watson, you’ve found a blind spot! Sure enough, Homebrew really works! 🌝

Your Command Line Tools (CLT) does not support macOS 11.
Copy the code

3. Reinstall CommandLineTools

$ sudo rm -rf /Library/Developer/CommandLineTools
$ sudo xcode-select --install
Copy the code

Based on the network environment, wait until the installation succeeds

4. Check the CLang version again

$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Copy the code

5. Try reinstalling the SDK?

$ pip install jqdatasdk. Successfully installed SQLalchemy-1.3.23 jqdatasdK-1.8.8 MSgpack-1.0.2 pandas 1.2.3 pymysqL-1.0.2 Requests - 2.25.1 thriftpy2-0.4.14Copy the code

Enjoy~

Afterword.

Test it out and take the first step:

from jqdatasdk import *

auth('xxxxxx'.'xxxxxx')

# Query the transaction data of Kweichow Moutai [600519.xSHG] in recent 5 days
df = get_price('600519.XSHG', count=5, end_date='2021-03-10', frequency='daily')
print(df)
Copy the code

At this point, the following results are obtained:

The get_price and get_fundamentals_continuously interface panel parameter will be fixed to False. Pandas does not support panel. Auth Success Open Close High Low Volume Money 2021-03-04 2095.00 2033.00 2096.00 2010.10 6508829.0 + 1.329730e+10 + 2021-03-08 + 2074.96 + 200.00 + 2085.00 + 1.329730e+10 + 2021-03-08 + 2074.96 + 2085.00 1960.00 6309959.0 1.272425e+10 + 2021-03-09 1955.00 1936.99 2000.00 1900.18 8226581.0 1.610077e+10 + 2021-03-10 1977.00 1970.01 1999.87 1967.00 5117174.0 1.013691e+10Copy the code

Get the data at the same time, remember to go to the professional stock trading website to check whether the data out of the query is accurate oh ~

Because this will directly affect the quantitative indicators behind!!

reference

Stackoverflow.com/questions/6…


Creation time: 2021-03-10 19:23:16

Original link: xkcoding.com/2021/03/10/…