All Projects → larsklitzke → tradingconv

larsklitzke / tradingconv

Licence: GPL-3.0 license
Convert trading history of cryptocurrency platforms

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tradingconv

Cryptex
Gemini, GDAX, Bitfinex, Poloniex, Binance, Kraken, Cryptopia, Koinex, BitGrail and CoinMarketCap cryptocurrency exchange API clients in Swift / iOS SDK. Check prices and account balances using Sample iOS app.
Stars: ✭ 51 (+112.5%)
Mutual labels:  cryptocurrencies, binance
Crypto vba
An Excel/VBA project to communicate with various cryptocurrency exchanges APIs
Stars: ✭ 103 (+329.17%)
Mutual labels:  cryptocurrencies, binance
pyjuque
⚡ Open Source Algorithmic Trading Bot for Python.
Stars: ✭ 318 (+1225%)
Mutual labels:  cryptocurrencies, binance
CoinTaxman
Calculate your taxes from cryptocurrency gains
Stars: ✭ 110 (+358.33%)
Mutual labels:  cryptocurrencies, binance
twitter-crypto-bot
This is a Twitter bot that tweets about cryptocurrencies prices every certain amount of minutes
Stars: ✭ 21 (-12.5%)
Mutual labels:  cryptocurrencies, binance
Vue Crypto Dashboard
Cryptocurrency Dashboard made with Vue
Stars: ✭ 107 (+345.83%)
Mutual labels:  cryptocurrencies, binance
Crypto Whale Watcher
An app to keep a watch on big volume trades of cryptocurrecies on different exchanges by sending alerts via a Telegram Bot.
Stars: ✭ 60 (+150%)
Mutual labels:  cryptocurrencies, binance
backtrading-python-binance
Backtesting several trading strategy and rank them according their profit return.
Stars: ✭ 108 (+350%)
Mutual labels:  cryptocurrencies, binance
binance-downloader
Python tool to download Binance Candlestick (k-line) data from REST API
Stars: ✭ 44 (+83.33%)
Mutual labels:  cryptocurrencies, binance
hands-on-elixir-and-otp-cryptocurrency-trading-bot
Source code to generate the "Hands-on Elixir & OTP: Cryptocurrency trading bot" book
Stars: ✭ 210 (+775%)
Mutual labels:  cryptocurrencies, binance
binance-node-docker
Docker image for Binance full and light nodes
Stars: ✭ 24 (+0%)
Mutual labels:  cryptocurrencies, binance
Benzaiboten-spot-trading-bot
A trading bot easy to use to be linked to your favorite exchange to automatize the trading on cryptocurrencies
Stars: ✭ 20 (-16.67%)
Mutual labels:  cryptocurrencies, binance
tradingview-jsapi-binance
Sample implementation of TradingView Charting Library JS API for Binance exchange
Stars: ✭ 41 (+70.83%)
Mutual labels:  binance
kafka-delta-ingest
A highly efficient daemon for streaming data from Kafka into Delta Lake
Stars: ✭ 139 (+479.17%)
Mutual labels:  delta
mokka
Free and extendable trading bot application for crypto currencies.
Stars: ✭ 20 (-16.67%)
Mutual labels:  binance
Binance-Asset-Manager
Extension of binance-python to automatically calculate balances and trade any trading pair.
Stars: ✭ 21 (-12.5%)
Mutual labels:  binance
scrapy-cookies
A middleware of cookies persistence for Scrapy
Stars: ✭ 19 (-20.83%)
Mutual labels:  cookies
TradingViewTools
Some scripts to automate things related to TradingView
Stars: ✭ 33 (+37.5%)
Mutual labels:  binance
iron-session
🛠 Node.js stateless session utility using signed and encrypted cookies to store data. Works with Next.js, Express, NestJs, Fastify, and any Node.js HTTP framework.
Stars: ✭ 1,729 (+7104.17%)
Mutual labels:  cookies
cookies
Manage your cookies on client and server side (Angular Universal)
Stars: ✭ 40 (+66.67%)
Mutual labels:  cookies

tradingconv

Are you trading with Cryptocurrencies on Binance? Do you need a tool to manage the different file formats platforms like Binance uses for exporting the trading history, e.g. to import into tax return software or for tracking your portfolie in delta or CoinTracking?

This package provide the appropriate tools for handling different formats of trading history files. Furthermore, the Binance API limitation that allows to only export trading history in an three month interval is lifted so that you can export your full trading history. No need to generate an API key and expose it to third-party applications. Just use you local login session.

Installation

This package is hosted on PyPI so just install tradingconv with

pip install tradingconv

Commands

This package comes equipped with multiple tools. Here is a list of currently available tools.

Command Description
binancecrawler Query Binance to export the full trade history
tradingconv Convert supported (csv,xlsx) files into other supported formats

Query Binance

Despite using the official API of Binance which limits the trade history to the last three month, binancecrawler is able to retrieve and export the full trade history.

Therefore, binancecrawler requires the session cookies of an active Binance connection on the current machine. The parameter --cookies should therefore point to a file containing a string with the cookies.

Save Binance session

In order to retrieve the Cookies of an active Binance session, log in into Binance and export the Cookies. I've setup a list of links with a description on how to do this for different browser.

Warning

To the best of my knowledge, the following cookies are currently required in order to gain access to the active session:

  • p20t

Save all of theses variables into a file with only one line in the following format:

line:=<var>+ <EOL>
var:=<variable>=<value>;
<variable> = "JSESSIONID" | "__BINANCE_USER_DEVICE_ID__ "

With <value> as the value of the variable. A line thus looks like:

p20t=<value>

Finally, we need an additional csrftoken Binance uses for internal queries. You can read this token out by switching to your account page, open the development console of you browser (the one where you've copied the cookies from) and search for an entry getUserLoginLog.html. You'll find the csrftoken in the header of the message.

Note that with the latest frontend update on Binance, the following image is outdated. Instead of searching for the getUserLoginLog.html you can find the token in get-open-orders or any other request on the private Binance API.

Image for retrieving the csrftoken

Retrieve transaction history from binance

You can now use binancecrawler to get trades in a certain interval with

binancecrawler --cookies <cookie_file> \
               --token <csrftoken> \
               --start "2018-01-01 00:00:00"\
               --end "2018-01-02 00:00:00"\
               --output binance_trades.csv \
               --mode trade

or the full history by passing a start some time ago your account creation.

binancecrawler --cookies <cookie_file> \
               --token <csrftoken> \
               --start "2018-01-01 00:00:00" \
               --output binance_trades.csv \
               --mode trading

For platforms such as CoinTracking you can also export all your deposits or withdrawals from Binance by just changing the mode. For all deposits, run the following

binancecrawler --cookies <cookie_file> \
               --token <csrftoken> \
               --start "2018-01-01 00:00:00" \
               --output binance_deposits.csv \
               --mode deposit

and for all withdrawals

binancecrawler --cookies <cookie_file> \
               --token <csrftoken> \
               --start "2018-01-01 00:00:00" \
               --output binance_withdrawals.csv \
               --mode withdrawal

Convert to other formats

To finally convert csv or xlxs files to the other csv or xlsx format, tradingconv does the trick.

The following source formats are supported:

  • bitpanda: From the export function of the Bitpanda website
  • binance: From the export function on the Binance website
  • binancecrawler: The csv file(s) created by binancecrawler

The following output formats are supported:

  • binance-trades: The xlsx format used by Binance for trades.
  • binance-deposit: The xlsx format used by Binance for deposits.
  • delta: The csv file format used by Delta.

More formats may supported in the future.

So, to convert the full trading history exported by binancecrawler to the delta format, simply call

tradingconv --format delta \
            --file binance_trades.csv \
            --output delta_trades.csv

or to the original binance format to import them into your portfolio tracking platform (e.g., CoinTracking) with

tradingconv --format binance \
            --file binance_trades.csv \
            --output binance_trades

The result is a xlsx with the same format as provided by Binance.

Note that there is no need to specify the format of the source file. tradingconv will search for the correct parser based on the columns in the file.

Thanks

If you like this tools, donate some bugs 💸 for a drink or two via PayPal. Cheers 🍻!

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].