-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConnect.py
More file actions
42 lines (35 loc) · 1.49 KB
/
Connect.py
File metadata and controls
42 lines (35 loc) · 1.49 KB
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
# Novixel's Connect To Coinbase - The Bitcoin Boxer
# Version 1 - First Official Release -
# April 17, 2021
#
# Connect.py
#
import ConfigSetup as cfg
import cbpro
import os
# Coinbase Connection For Our Config Data
class CoinConnect:
# This will do everything involving the coinbase api!
auth = None
def __init__(self): # Set up on creation
# Build directory for our config file if not already done
cfg.BuildBotNest()
if os.path.isfile(cfg.pathStr): # if file is a file! We continue
pass # File was found sooo all is well
else:
print("\nConfig File Not Found!\nBuilding Setup File!\n") # else: we make a file
cfg.BuildBotSettings()
print("\nThe Config File Was Created!\n")
# This set Our API Keys for the Coinbase Pro account we want to use.
# Set your api key --------- if not already set
if cfg.ReadConfig("key") == "CoinbaseProAPI key":
key = input("Enter API KEY:\n")
secret = input("Enter API SECRET:\n")
passphrase = input("Enter API PASSPHRASE:\n")
cfg.SaveNewApi(key,secret,passphrase)
else: # Read your already set key
key = cfg.ReadConfig("key")
secret = cfg.ReadConfig("b64secret")
passphrase = cfg.ReadConfig("passphrase")
# Create a authenticated client for the coinbase api
self.auth = cbpro.AuthenticatedClient(key,secret,passphrase)