Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Denton24646/Titan
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/database/database.py
#	core/titan_main.py
  • Loading branch information
cpmcgee committed Feb 4, 2018
2 parents d78a7da + 4a8d933 commit 1b0240d
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# Titan
Cryptocurrency trading bot framework

Objective: Write a cryptocurrency trading bot in a framework that allows for the implementation of various machine learning algorithms to determine trade behavior.
![Alt Text](https://i.imgur.com/uebAKT4.png)



Titan is a totally free cryptocurrency automated trading framework for traders of all skill levels. Built on top of the ccxt API library, it works out of the box with any exchange and trading pair. We believe in decentralizing trading strategies and providing everyone access to building advanced crypto portfolios. The future of algorithmic trading is here!

The base framework comes with a set of methods that allow you to program trading logic and write data to your own database with ease. A sample strategy based on moving average crossovers is provided out of the box to experiment as well as a full simulation suite where one can trade fake BTC against real market prices. The original objective of the project was to write a cryptocurrency trading bot in a framework that allows for the implementation of various machine learning algorithms to determine trade behavior.

## FAQ

#### Spare me the mumbo-jumbo! What's this all about?
IT PRINTS MONEY

#### But wait, why would you ever release this for free??? hurr-durr profits
Ah yes, I see you've taken a basic microeconomics course before. Truth is, this is mainly a project to encourage people to write their own strategies and have a way to test them out. We want to lower the bar to algorithmic cryptocurrency trading to those who are interested but don't know where to start.

#### This sounds cool, I want to get involved!
Great, there's tons of cool stuff you can work on. Beginners welcome. Check out our discord [here!](https://discord.gg/4r9Qxuf)

#### What's with the name Titan anyway?
Sounds cool as heck, think about it. "Yeah made 5 BTC using that Titan trading system" has a certain ring to it. Plus it makes us feel important, ok?


## Instructions
![Alt Text](https://media.giphy.com/media/v5Ewl8EnO4KFW/giphy.gif)
5 changes: 4 additions & 1 deletion core/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

logger = logging.getLogger(__name__)

db_name = 'db_dev.db'
db_name = 'core.db'
db_fullpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), db_name)
lock = Lock()
engine = create_engine('sqlite:///{}'.format(db_fullpath), connect_args={'check_same_thread': False}, echo=False)
Expand Down Expand Up @@ -76,11 +76,14 @@

def drop_tables():
print('Dropping tables...')
metadata.drop_all(engine)


def create_tables():#
print('Creating tables...')
metadata.create_all(engine)


def reset_db():
print('Resetting database...')
drop_tables()
Expand Down
15 changes: 12 additions & 3 deletions core/titan_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
logger = logging.getLogger(__name__)


def main(user_input):

def start_strategy(user_input):

# strategy = poc_strategy.PocStrategy("5m", 'bittrex', 'ETH', 'BTC', 100, 700, True, sim_balance=10)
# strategy2 = poc_strategy.PocStrategy("5m", 'binance', 'ETH', 'BTC', 233, 900, True, sim_balance=10)
Expand All @@ -17,10 +18,16 @@ def main(user_input):
strategy.start()


def reset_db():
def start_database():
database.create_tables()


def start():
try:
# wipe and recreate tables
database.reset_db()
database.create_tables()

start_strategy()

except Exception as e:
print(e)
Expand All @@ -29,3 +36,5 @@ def reset_db():
database.engine.dispose()


if __name__ == "__main__":
start()
2 changes: 1 addition & 1 deletion templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3>Introduction</h3>
<br><br><br>
<div class ="Trading Settings">
<h3>Trading Platform</h3>
<form action="{{ url_for('initialize_bot') }}" method="POST">
<form action="{{ url_for('strategy') }}" method="POST">
Exchange:<br>
<input type="text" name="exchange"> <br><br>
Base Currency:<br>
Expand Down
9 changes: 6 additions & 3 deletions titan_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging

app = Flask(__name__)
titan_main.start_database()

app.config['SECRET_KEY'] = '100'
app.debug = True
Expand All @@ -18,8 +19,8 @@ def mainpage():
return render_template('main.html')


@app.route("/initialize_bot", methods=['POST'])
def initialize_bot():
@app.route("/strategy", methods=['POST'])
def strategy():
user_exchange = request.form['exchange']
user_basecurrency = request.form['basecurrency']
user_quotecurrency = request.form['quotecurrency']
Expand All @@ -28,7 +29,9 @@ def initialize_bot():

user_input = [user_exchange.lower(), user_basecurrency.upper(), user_quotecurrency.upper(), user_candleinterval, bool(user_simulationtrade)]

titan_main.main(user_input)

titan_main.start_strategy(user_input)


return render_template('results.html')

Expand Down

0 comments on commit 1b0240d

Please sign in to comment.