Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Move to package
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian committed May 10, 2020
1 parent e761b3d commit 4e7dd92
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name='tradingview_ta',
version='2.0.0',
description="A python module to scrape tradingview's technical analysis.",
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/deathlyface/python-tradingview-ta',
author='deathlyface',
author_email='[email protected]',
packages=['tradingview_ta'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6')
1 change: 1 addition & 0 deletions tradingview_ta/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .main import ta_handler
20 changes: 0 additions & 20 deletions tradingview_ta.py → tradingview_ta/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
class ta_handler:
""" ta_handler class
Create an instance of this class to get TradingView's technical analysis.
Values:
pair (string): Pair name, not case-sensitive (ex: "btcusd").
interval (string): Interval rate, not case-sensitive (default: "1m" for 1 minute).
str_driver (string): Webdriver name, not case-sensitive (default: "chrome").
headless (bool): Use headless browser for chrome and firefox (default: True).
last_analysis (list): return the last analysis.
Functions:
start_driver(): Start the webdriver.
get_analysis(): Return a list of analysis.
Expand All @@ -31,7 +29,6 @@ class ta_handler:
#Set webdriver
def start_driver(self):
""" start_driver Function
This function will set up a webdriver.
Returns:
Expand Down Expand Up @@ -70,7 +67,6 @@ def start_driver(self):
#Get analysis
def get_analysis(self):
""" get_analysis Function
This function will return a list containing recommendation (buy/sell) and counters (number of analysis of sell, neutral, and buy).
Returns:
Expand Down Expand Up @@ -110,19 +106,3 @@ def get_analysis(self):

self.last_analysis = analysis
return analysis


if __name__ == "__main__":
btcusd = ta_handler()

btcusd.pair = "btcusd"
btcusd.interval = "1m"
btcusd.driver = "chrome"
btcusd.headless = True

btcusd.start_driver()
analysis = btcusd.get_analysis()
print("Recommendation: {}".format(analysis[0]))
print("Sell: {}".format(analysis[1]))
print("Neutral: {}".format(analysis[2]))
print("Buy: {}".format(analysis[3]))

0 comments on commit 4e7dd92

Please sign in to comment.