forked from akmayer/Warframe-Algo-Trader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
59 lines (51 loc) · 1.49 KB
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import sqlite3
import os
import json
filename = "inventory.db"
if not os.path.exists(filename):
with open(filename, "w"):
pass # Creating an empty file
print(f"File '{filename}' created successfully!")
else:
print(f"File '{filename}' already exists.")
con = sqlite3.connect('inventory.db')
cur = con.cursor()
# Connecting to the geeks database
# Creating a cursor object to execute
# SQL queries on a database table
# Table Definition
cur.execute('''CREATE TABLE if not exists inventory(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
purchasePrice REAL NOT NULL,
listedPrice INTEGER,
number INTEGER NOT NULL) STRICT;
''')
cur.execute("""
CREATE TABLE IF NOT EXISTS transactions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
datetime TEXT,
transactionType TEXT,
price INTEGER
) STRICT
""")
con.close()
filename = "config.json"
config_data = {
"pushbutton_token": "",
"pushbutton_device_iden": "",
"webhookLink" : "",
"wfm_jwt_token": "",
"inGameName" : "",
"runningLiveScraper": False,
"runningStatisticsScraper": False,
"runningWarframeScreenDetect": False,
"platform" : ""
}
if not os.path.exists(filename):
with open(filename, "w") as file:
json.dump(config_data, file, indent=4)
print(f"File '{filename}' created successfully!")
else:
print(f"File '{filename}' already exists.")