Giter Site home page Giter Site logo

jaimindp / twitter_activated_crypto_trading_bot Goto Github PK

View Code? Open in Web Editor NEW
107.0 13.0 39.0 48.08 MB

Buys crypto through keyword detection in new tweets. Executes buy in 1 second and holds for a given time (e.g. Elon tweets 'doge', buys Dogecoin and sells after 5 minutes). Tested on Kraken and Binance exchanges

Python 100.00%
binance dogecoin trading-bot crypto cryptocurrency tweets twitter twitter-bot kraken trading

twitter_activated_crypto_trading_bot's Introduction

Tweet Activated Crypto Trader

This project is now www.lazytrade.io. Execute crypto trades with one touch on Telegram!

For the fully automated trading version of this app see below!

March 23rd 2021 - Stopped updating repo, building functionality privately. Message for info.

twitter_exchanges.py works with querying. Issue with streaming fixed too. (Mar 23rd)

New thread created for trade so multiple trades can occur concurrently under streaming. Ctrl-c will allow the trades to close out in the given time and the program to exit automatically. (March 17th)

Fixed issue with querying. New coin listings from coinbase, coinbasepro and binance successfully traded +25%. Works when BNB is in binance account to take fees. (March 15th)

Buy amount now requested in $ and dynamically adjusted to valid crypto amount based on latest exchange rate. (Mar 9th)

Set up for futures trading up to 100x leverage (not on github), successfully returned 100%+ from Elon's doge tweets

Overview

The idea is to buy crypto using a Twitter trigger and sell after a user specified time / price / % gain e.g. when Elon musk tweets about Dogecoin or when a new coin is listed on an exchange

Markets, particularly small market cap altcoins are heavily influenced by individuals with large following 'hyping' up a cryptocurrency AKA crypto pumps. We can capitalise on this opportunity by being one of the first to exectue trades when a tweet is posted

As soon as Tweet is posted, ~5s with streaming/~1s querying, the program checks for substring matches with keywords for a particular cryptocurrency. These keywords and coins can be user specified from the keywords json files to implement any trade strategies

Threading for streaming tweets so trade executions run in a separate thread allowing multiple trades to occur at once. When ctrl-c is hit, it waits for the trades to sell automatically according to the specification then closes the program

The buy amount is input in $ and based on the latest prices from the exchange, the program will calculate valid buy and (multiple) sell amounts as close to the specified $ amount as the market will allow (Binance). BNB coin required in account to take fees. With Kraken, the buy amount has to be a valid tradeable amount in crypto and when divided by the number of selling trades, also has to leave valid tradeable amounts

To configure on local system:
pip install -r requirements.txt

To run with Binance (monitors a single ticker):
python twitter_binance.py

To run with Kraken (monitors a single ticker):
python twitter_kraken.py

API keys are kept in a json, one directory up from repo ../keys.json

{
    "twitter_keys":{
        "consumer_key":"XXXXXXXXXXXXXXXXXXXX",
        "consumer_secret":"XXXXXXXXXXXXXXXXXXXX",
        "access_token_key":"XXXXXXXXXXXXXXXXXXXX",
        "access_token_secret":"XXXXXXXXXXXXXXXXXXXX"
    },
    "binance_keys":{
        "api_key":"XXXXXXXXXXXXXXXXXXXX",
        "secret_key":"XXXXXXXXXXXXXXXXXXXX"
    },
    "kraken_keys":{
    	"api_key":"XXXXXXXXXXXXXXXXXXXX",
        "secret_key":"XXXXXXXXXXXXXXXXXXXX"
    }
}

Notes

  • Requires a Twitter Developer API detecting tweets through Tweepy
  • Requires a crypto exchange (Kraken/Binance) API which is used through ccxt (cryptocurrency exchange trading library)
    • ccxt allows universal function calls to be used on multiple exchanges (adding a new exchange should not be difficult as long as ccxt has the same functions implemented)
  • If anything is not working correctly, let me know!

twitter_activated_crypto_trading_bot's People

Contributors

jaimindp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter_activated_crypto_trading_bot's Issues

Crash with proposed json config

Hi, I am testing your software (successfully with self tweet)
I noticed that python twitter_binance.py crashes if specified (with values or not) the kraken line.
The keys.json with twitter_binance.py works with this format

{ "twitter_keys":{ "consumer_key":"xxx", "consumer_secret":"xxx", "access_token_key":"xxx", "access_token_secret":"xxx" }, "binance_keys":{ "api_key":"xxx", "secret_key":"xxx" } }

help

Traceback (most recent call last):
File "twitter_binance.py", line 6, in
from stream_multiple import *
File "/home/ubuntu/Tdoge/stream_multiple.py", line 8, in
from tweepy.streaming import StreamListener
ImportError: cannot import name 'StreamListener' from 'tweepy.streaming' (/home/ubuntu/.local/lib/python3.8/site-packages/tweepy/streaming.py)

Default coin?

Is there a specified coin needed to make a buy order ? What type of coin should I have in my wallet so that this bot can work?

ModuleNotFoundError: No module named 'binance_futures_api'

New error, ive tried pip install binance_futures_api, but theres no module.

C:\Users\Adobe\Desktop\Twitter_Activated_Crypto_Trading_Bot-main>python twitter_kraken.py
Traceback (most recent call last):
File "twitter_kraken.py", line 6, in
from stream import *
File "C:\Users\Adobe\Desktop\Twitter_Activated_Crypto_Trading_Bot-main\stream.py", line 9, in
from binance_futures_api import *
ModuleNotFoundError: No module named 'binance_futures_api'

Fail at tweet collector

I've got two errors during the last days (last git fetch)
While waiting for tweet, running for 2-3 days

one session

[{'message': 'Internal error', 'code': 131}]
Failed at tweet collector

another session

[{'message': 'Over capacity', 'code': 130}]
Temporarilty failed at tweet collector

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.