Ejemplo n.º 1
0
import argparse

import pandas as pd

from datetime import datetime

from alpaca_trade_api import StreamConn

# For some fun colors...
from colorama import Fore, Style, init as ColoramaInit

API_KEY = "PKLZQLI4OJHYFFHBDS4F"
API_SECRET = "WCMAUIAmBrgwHDIZb5iwbDqRWhWAm2ulUSJU0jXi"
APCA_API_BASE_URL = 'wss://data.alpaca.markets/stream'

ColoramaInit(autoreset=True)

# Make this global
opt = None


def ts():
    return pd.Timestamp.now()


def log(*args, **kwargs):
    print(ts(), " ", *args, **kwargs)


def debug(*args, **kwargs):
    print(ts(), " ", *args, file=sys.stderr, **kwargs)
Ejemplo n.º 2
0
###################################################################################################
ScriptName = os.path.basename(__file__)

pyPlatform = platform.system()

args = None
dockerBin = None
dockerComposeBin = None
opensslBin = None

###################################################################################################
try:
    from colorama import init as ColoramaInit, Fore, Back, Style

    ColoramaInit()
    coloramaImported = True
except:
    coloramaImported = False

###################################################################################################
# perform a service-keystore operation in a Docker container
#
# service - the service in the docker-compose YML file
# keystore_args - arguments to pass to the service-keystore binary in the container
# run_process_kwargs - keyword arguments to pass to run_process
#
# returns True (success) or False (failure)
#
def keystore_op(service, dropPriv=False, *keystore_args, **run_process_kwargs):
    global args