Table of contents:
The purpose of this application is to provide a toolkit to:
Research only; there is no capability for live-trading at exchanges.
See requirements.txt
Note: to run and train the DQN Agent (./agent/dqn.py
) tensorflow and Keras-RLneed to be installed manually and are not listed in the requirements.txt
in order to keep this project compatible with other opensourced reinforcement learning platforms(e.g., OpenAI Baselines).
Pip install the following:
git+https://github.com/manahl/arctic.git
Keras==2.2.4
Keras-Applications==1.0.7
Keras-Preprocessing==1.0.9
keras-rl==0.4.2
tensorboard==1.13.1
tensorflow-estimator==1.13.0
tensorflow-gpu==1.13.1
The key elements in this project and brief descriptions.
crypto-rl/
agent/
...reinforcement learning algorithm implementations
data_recorder/
...tools to connect, download, and retrieve limit order book data
gym_trading/
...extended openai.gym environment to observe limit order book data
indicators/
...technical indicators implemented to be O(1) time complexity
design-patterns/
...visual diagrams module architecture
venv/
...virtual environment for local deployments
experiment.py # Entry point for running reinforcement learning experiments
recorder.py # Entry point to start recording limit order book data
configurations.py # Constants used throughout this project
requirements.txt # List of project dependencies
setup.py # Run the command `python3 setup.py install` to
# install the extended gym environment i.e., gym_trading.py
Refer to each individual module for design pattern specifications:
Sample snapshot of Limit Order Book levels:
Sample snapshot of Order Arrival flow metrics:
Install the project on your machine:
# Clone the project from github
git clone https://github.com/sadighian/crypto-rl.git
cd crypto-rl
# Install a virtual environment for the project's dependencies
python3 -m venv ./venv
# Turn on the virtual environment
source venv/bin/activate
# Install keras-rl dependencies
pip3 install Keras==2.2.4 Keras-Applications==1.0.7 Keras-Preprocessing==1.0.9 keras-rl==0.4.2
tensorboard==1.13.1 tensorflow-estimator==1.13.0 tensorflow-gpu==1.13.1
# Install database
pip3 install git+https://github.com/manahl/arctic.git
# Install the project
pip3 install -e .
Step 1:Go to the configurations.py
and define the crypto currencies whichyou would like to subscribe and record.
Note: basket list format is as follows [(Coinbase_Instrument_Name, Bitfinex_Instrument_Name), ...]
SNAPSHOT_RATE = 5 # I.e., every 5 seconds
BASKET = [('BTC-USD', 'tBTCUSD'),
('ETH-USD', 'tETHUSD'),
('LTC-USD', 'tLTCUSD'),
('BCH-USD', 'tBCHUSD'),
('ETC-USD', 'tETCUSD')]
RECORD_DATA = True
Step 2:Open a CLI/terminal and execute the command to start recordingfull limit order book and trade data.
python3 recorder.py
Step 1:Ensure that you have data in your database.
Check with MongoDB shell or Compass.If you do not have data, see refer to the section above6.1 Record limit order book data from exchanges.
Step 2:Run a historial data simulation to take snapshots of thelimit order book(s) and export their stationary featuresto a compressed csv.
To do this, you can leverage the test cases in data_recorder/tests/
or write your own logic. When using the test case methods, make sureto change the query parameters to match what you've actually recorded andis in your database.
Example to export features to a compressed csv:
python3 data_recorder/tests/test_extract_features.py
Step 1:Ensure you have data in the data_recorder/database/data_exports/
folder.This is where the agent loads data from. If you do not have data exportedinto that folder, see refer to the section above6.2 Replay recorded data to export stationary feature set.
Step 2:Open a CLI/terminal and start learning/training the agent.
python3 experiment.py --window_size=50 --weights=False --fitting_file=...
Refer to experiment.py
to see all the keyword arguments.
Please remember to cite this repository if used in your research:
@misc{Crypto-RL,
author = {Jonathan Sadighian},
title = {Deep Reinforcement Learning Toolkit for Cryptocurrencies},
year = {2019},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/sadighian/crypto-rl}},
}
There are multiple branches of this project, each with a different implementation patternfor persisting data:
Note: the branches below (i.e., lightweight, order book snapshot, mongo integration)are no longer actively maintained as of October 2018, and are here for reference.
pip3 install -e .
)requirements.txt
: going forward the database requires a manualinstallation via pip install git+https://github.com/manahl/arctic.git
env
s and broker
s for simplification andadded different reward
approaches.Indicator.py
base classRSA新套路,记录一下。 题目源码: from secret import flag, x, y from Crypto.Util.number import * D = 0x1337 assert x**2 - D*y**2 == 1 p, q = [getPrime(1024) for _ in range(2)] n = p * q e = 0x10001 m = bytes_to_lo
接上次的RSA,我们来接着学习RSA在CTF的常见类型题目。新涉及了python中的sympy库,利用里面的中国剩余定理函数。 低加密指数广播攻击 在RSA中e也称为加密指数。由于e是可以随意选取的,选取小一点的e可以缩短加密时间(比如3),但是选取不当的话,就会造成安全问题 如果选取的加密指数较低,并且使用了相同的加密指数将一个信息多次加密(广播),那么可以进行广播攻击得到明文。选取了相同的加密
package crypto import "crypto" crypto包搜集了常用的密码(算法)常量。 Index 返回首页 type PublicKey type PrivateKey type Hash func (h Hash) Available() bool func (h Hash) Size() int func (h Hash) New() hash.Hash func Re
一道有趣的题,知识点:因数分解(费马的方法): (1)待分解的数n=10379。计算√n(指n的开平方,下同)。它不是整数,否则10379就是一个平方数了,而平方数已完成了至少一步因数分解。 (2)取大于等于√n的正整数N。可写成N=[√n]+1,其中[ ]是取整函数。显然,N^2>n。 (3)求N^2-n。然后考察它是不是平方数。注意,N^2-n应该不是很大,所以,比较容易判断它是不是平方数。
1.crypto (node.js) 1.1 加密 var key = '2cef781a9c0411eb' var str = JSON.stringify({ "ip": "192.168.12.1", "mac": "80:3F:5D:0E:04:2B", "wan_ip": "0.0.0.0", "internet": "1", "5g_ssid": "531A6-yang_test_2
2.创建工具函数encryptPassword.ts实现加密 encryptPassword 这个文件实现的是传入一个字符串 然后给你加密 这里是用于密码的。 密码不要明文存储 根据用户的输入的密码,在加密一次存储到数据库,登录时,在把输入的加密一次,和数据库的比对,一样就登陆成功了 import * as crypto from 'crypto'; import config from '.
I am using a SAML authentication mechanism to authenticate my application. I am using IDP server as ADFS and SP as JBoss EAP 7.1.4. I have added all the configurations related to the IDP and sp server
这回基本没有crypto,pwn题后几个有难度,一直整不出来,等WP pwn Sanity drink 只要求输入与密码相同,输入可以覆盖到密码 int __cdecl main(int argc, const char **argv, const char **envp) { char user_password[32]; // [rsp+0h] [rbp-50h] BYREF char
Overview 因为Java的Crypto API始终有点难用,SpringSide在core module中的org.springside.modules.security.utils中提供了封装。 API的出入参数都是byte[]数组,需要配合Encodes来转换成Hex或Base64存储。 Digests消息摘要 去年一轮的密码被盗风波后,使用salt并迭代N次的sha-1式密码存储已经是
The crypto component hosts all the implementations of cryptographic primitives we use in Libra: hashing, signing, and key derivation/generation. The NextGen directory contains implementations of crypt
crypto 跟加密相关的一些功能,包括安全验证等。
crypto 包括 attr、ecdsa、utils 子包。 attr:chaincode 属性检查校验; ecdsa:ecdsa 加密算法接口,一些 hash 和签名校验方法。 utils:提供 aes、ecdsa、x509 等方法。
crypto模块的目的是为了提供通用的加密和哈希算法。用纯JavaScript代码实现这些功能不是不可能,但速度会非常慢。Nodejs用C/C++实现这些算法后,通过cypto这个模块暴露为JavaScript接口,这样用起来方便,运行速度也快。 MD5和SHA1 MD5是一种常用的哈希算法,用于给任意数据一个“签名”。这个签名通常用一个十六进制的字符串表示: const crypto = req
import "crypto" crypto包搜集了常用的密码(算法)常量。 type PublicKey type PublicKey interface{} 代表一个使用未指定算法的公钥。 type PrivateKey type PrivateKey interface{} 代表一个使用未指定算法的私钥。 type Hash type Hash uint Hash用来识别/标识另一个包里实现