Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f6d6816
final files
AlexisDaniels May 30, 2021
386dd0d
Add files via upload
AlexisDaniels May 30, 2021
9c591f6
Add files via upload
AlexisDaniels May 30, 2021
f1caf9a
Update README.md
AlexisDaniels May 30, 2021
c65e7c9
f
May 30, 2021
f551436
Vignettes
May 30, 2021
84a5ce1
all
May 31, 2021
c8f24b7
working
May 31, 2021
97e6c9d
final version, only necessary files
May 31, 2021
158c084
Deleted copy of vignette
AlexisDaniels May 31, 2021
0305316
Deleted copy of vignette
AlexisDaniels May 31, 2021
997759a
Delete Untitled.ipynb
AlexisDaniels May 31, 2021
bc2d5cc
Delete Untitled1.ipynb
AlexisDaniels May 31, 2021
3f1440b
Delete bot.py
AlexisDaniels May 31, 2021
502c7c9
Delete bot2.py
AlexisDaniels May 31, 2021
22f6372
no idea
May 31, 2021
49bb623
updated with all imports
May 31, 2021
3ab9978
Merge branch 'final_version' of https://github.com/Programming-The-Ne…
May 31, 2021
173f39c
aa
May 31, 2021
229060e
Delete Bot Functions.ipynb
AlexisDaniels May 31, 2021
b13d8b6
Delete Crypto GUI-Copy1 (1).ipynb
AlexisDaniels May 31, 2021
d78cf6c
Documentation added
May 31, 2021
0e84672
Merge branch 'final_version' of https://github.com/Programming-The-Ne…
May 31, 2021
dade5a3
Fixed spacing
May 31, 2021
5ec1406
ALL FILES
May 31, 2021
34afe12
Merge branch 'main' into final_version
AlexisDaniels May 31, 2021
7562eb0
Delete RSI_OVERBOUGHT:
AlexisDaniels May 31, 2021
c4731b3
Delete background_image.png
AlexisDaniels May 31, 2021
e7880a0
Delete bot.py
AlexisDaniels May 31, 2021
3e62285
Delete crypto_selection.py
AlexisDaniels May 31, 2021
b25f9ed
Delete gui.py
AlexisDaniels May 31, 2021
9fd9f9c
Delete requirements.txt
AlexisDaniels May 31, 2021
26039f8
Delete __pycache__ directory
AlexisDaniels May 31, 2021
f239083
Delete .ipynb_checkpoints directory
AlexisDaniels May 31, 2021
2478260
Delete .vscode directory
AlexisDaniels May 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Crypto_Bot
Submodule Crypto_Bot added at faee72
439 changes: 439 additions & 0 deletions Notebook/Bot Functions.ipynb

Large diffs are not rendered by default.

229 changes: 229 additions & 0 deletions Notebook/Crypto GUI.ipynb

Large diffs are not rendered by default.

Binary file removed __pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file removed __pycache__/bot.cpython-39.pyc
Binary file not shown.
Binary file removed __pycache__/config.cpython-39.pyc
Binary file not shown.
Binary file removed __pycache__/crypto_selection.cpython-39.pyc
Binary file not shown.
Binary file removed background_image.png
Binary file not shown.
95 changes: 0 additions & 95 deletions bot.py

This file was deleted.

110 changes: 105 additions & 5 deletions bot_API.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#### This script runs perfectly - for updates, see Final_GUI.py
#LAST

from tkinter.constants import END
Expand Down Expand Up @@ -33,6 +32,24 @@

coin = 'litecoin'
def bot_api(coin):
"""
A function that retrieves the latest price of the selected cryptocurrency from the API
of coinmarketcap.

If an unexistent symbol is computed, no value is retrieved

Properties
-----------
coin : str
the symbol of a cryptocurrency

Returns
--------
str
A string with the latest value of the specified cryptocurrency

"""

global data

parameters = {
Expand Down Expand Up @@ -84,6 +101,7 @@ def add_image(coin):
coin_image.image_create(END, image = my_image)

async def main(symbol, prices):

global xdata
global results

Expand All @@ -105,13 +123,72 @@ async def main(symbol, prices):
return(results)

def run_bot2(symbol, prices):
"""
This function can obtain real-live prices of cryptos every second.

This function contains the asynchronous function main(), which uses the
Binance websocket in order to retrieve the latest cryptocurrency from
its platform each second. With this, a loop is set to run 15 times (enough
values to calculate the RSI of 14 timepoints). The results from the 15
values are stored within the 'results' object.
It is important to note that, while the values are being calculated, it
is not possible to use anything else from the GUI.

If an unexistent symbol is specified, no value is retrieved.

Properties
-----------
symbol : str
the symbol of a cryptocurrency
prices : int
The ammount of prices you want to retrieve

Returns
-------
list
A list with the ammount of cryptocurrency values specified
"""

if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main(symbol, prices))
return(results)


def historical(symbol, interval, startYear, startMonth, startDay, endYear, endMonth, endDay):
"""
This function can retrieve historical data of any crypto in a graph

It connect with the API from Binance and it appends the closing candlestick
values of the crypto, with a specified interval.

Properties
----------
symbol : str
A cryptocurrency symbol
interval : str
Interval of closing candlesticks
startYear : str
The year of the starting date
startMonth : str
The month of the starting date
startDay : str
The day of the starting date
endYear : str
The year for the ending date
endMonth : str
The month for the ending date
endDay : str
The day for the ending date

Returns
--------
dataframe
A dataframe with all the values that appear in the graph
plot
A graph with the crpto values (x_axis = date, y_axis = price)
"""

global df

url = 'https://api.binance.com/api/v3/klines'
Expand All @@ -137,6 +214,32 @@ def historical(symbol, interval, startYear, startMonth, startDay, endYear, endMo
return df

def rsi(symbol, prices):
"""
This function calculate the Relative Strength Index (RSI) from live crypto
prices

It uses the run_bot2 function to communicate with the websocket from
Binance, and after 15 values have been obtained, it calculates the RSI,
and it displays a message with a suggestion to buy/sell/retain:
- If RSI > 70 = Market is bearish/overbought, you should sell now
- If 30 < RSI > 70 = Market is stable, you should not do anything
- If RSI < 30 = Market is bullish/oversold, you should buy now

Properties
----------
symbol : str
a crypto symbol
prices : int
(optional) it is set to 15 as default

Returns
-------
float
The RSI value
str
The buying/selling/retaining decision
"""

df = run_bot2(symbol, prices)
print(df)
df = np.array(df, dtype='f8')
Expand All @@ -160,6 +263,7 @@ def rsi(symbol, prices):

if last_rsi > RSI_OVERSOLD and last_rsi < RSI_OVERBOUGHT:
decision = "RELAX AND DO NOTHING"

print(decision)

last_rsi = round(last_rsi, 2)
Expand All @@ -173,10 +277,6 @@ def do_rsi(symbol, prices):
entry_rsi.insert(0, ('RSI value: {}, {}').format(rsi_value, decision))


# rsi('btc', 25) #'1d', 2020,4,1,2020,5,1)



# ------------------ GUI ---------------------- #

root = tk.Tk()
Expand Down
23 changes: 0 additions & 23 deletions crypto_selection.py

This file was deleted.

Binary file added demos/Crypto_Price_Demo.mov
Binary file not shown.
Binary file added demos/Crypto_RSI_demo.mov
Binary file not shown.
Binary file added demos/GUI_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/Historical_demo.mov
Binary file not shown.
Binary file added demos/RSI_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/run_bot2_demo.mov
Binary file not shown.
Loading