-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from AramKoorn/hidden_files
fix #14
- Loading branch information
Showing
18 changed files
with
235 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
from .version import __version__ | ||
from tenbagger.version import __version__ | ||
from tenbagger.src.utils.builtin_utils import read_from_root, read_json, create_hidden_folder, write_json | ||
import os | ||
from pathlib import Path | ||
|
||
|
||
CWD = os.getcwd() | ||
DIRECTORY = os.path.dirname(os.path.abspath(__file__)) | ||
os.chdir(DIRECTORY) | ||
FILES = ['staking.json', "portfolio.json", "environment.json"] | ||
|
||
HOME_PATH = Path.home() | ||
TENBAGGER_PATH = f'{HOME_PATH}/.tenbagger' | ||
create_hidden_folder('tenbagger') | ||
os.chdir(TENBAGGER_PATH) | ||
|
||
HIDDEN_FILES = os.listdir() # Get files in .tenbagger | ||
for f in set(FILES) - set(HIDDEN_FILES): | ||
os.chdir(DIRECTORY) | ||
to_dump = read_json(f'configs/{f}') | ||
os.chdir(TENBAGGER_PATH) | ||
write_json(loc=f, data=to_dump) | ||
|
||
os.chdir(CWD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"CURRENCY": "EUR", | ||
"MAINPORTFOLIO": "my_portfolio", | ||
"TELEGRAMID": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Here you can specify your preferred environment. | ||
# E.G. CURRENCY: "EUR" | ||
|
||
CURRENCY: "EUR" | ||
MAINPORTFOLIO: "my_portfolio" | ||
TELEGRAMID: "" | ||
TELEGRAMTOKEN: "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"my_portfolio": | ||
{ | ||
"ibm": 10, | ||
"aapl": 20, | ||
"eth-usd": 2 | ||
}, | ||
"WSB": | ||
{ | ||
"wish": 1000, | ||
"tsla": 100, | ||
"shib-eur": 100000, | ||
"nvda": 100, | ||
"baba": 100, | ||
"bb": 100, | ||
"gme": 1000, | ||
"amc": 1000, | ||
"intc": 1000, | ||
"eth-eur": 10 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# This is an example of a portfolio that contains 10 ibm shares 20 appple shares | ||
# and 2 ethereum tokens. | ||
# | ||
# This is an example. You can delete/modify this portfolio if you want. | ||
my_portfolio: | ||
ibm: 10 | ||
aapl: 20 | ||
eth-usd: 2 | ||
|
||
WSB: | ||
wish: 1000 | ||
tsla: 100 | ||
shib-eur: 100000 | ||
nvda: 100 | ||
baba: 100 | ||
bb: 100 | ||
gme: 1000 | ||
amc: 1000 | ||
intc: 1000 | ||
eth-eur: 10 | ||
|
||
# You can modify the current portfolio or add a new portfolio. Make sure that you use ticker | ||
# symbols as listed on yahoo finance. for instance, if you want to add a portfolio called household_portfolio that contains 5 tesla shares: | ||
household_portfolio: | ||
TSLA : 5 | ||
|
||
# Some hypothetical portfolio containing stocks and crypto | ||
hypothetical_portfolio: | ||
algo-eur: 2500 | ||
IBM: 10 | ||
BTC-USD: 0.5 | ||
AAPl: 2 | ||
ETH-USD: 2 | ||
TSLA: 10 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"eth-usd": 0.0735, | ||
"eth-eur": 0.0735, | ||
"dot1-usd": 0.1313, | ||
"dot1-eur": 0.1313, | ||
"algo-eur": 0.06 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
eth-usd: 0.0735 | ||
eth-eur: 0.0735 | ||
dot1-usd: 0.1313 | ||
dot1-eur: 0.1313 | ||
algo-eur: 0.06 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import json | ||
import os | ||
from pathlib import Path | ||
import logging | ||
|
||
|
||
def read_json(loc : str): | ||
''' | ||
:param loc: path to file | ||
:return: yaml converted to a dictionary | ||
''' | ||
with open(loc) as f: | ||
data = json.load(f) | ||
|
||
return data | ||
|
||
|
||
def write_json(data, loc): | ||
with open(loc, 'w') as json_file: | ||
json.dump(data, json_file) | ||
|
||
|
||
def read_from_root(file: str): | ||
|
||
cwd = os.getcwd() | ||
home_path = str(Path.home()) + '/.tenbagger' | ||
os.chdir(home_path) | ||
|
||
data = read_json(loc=file) | ||
os.chdir(cwd) | ||
return data | ||
|
||
|
||
def create_hidden_folder(name: str): | ||
|
||
cwd = os.getcwd() | ||
home_path = Path.home() | ||
os.chdir(home_path) | ||
|
||
if os.path.exists(f".{name}"): | ||
logging.info("Folder already exist") | ||
return | ||
|
||
os.mkdir(f".{name}") | ||
os.chdir(cwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.7.3" | ||
__version__ = "0.8.1" |
Oops, something went wrong.