Example #1
0
    def __init__(self, Id=None, level='debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        mDwn.__init__(self, self.Id, level)

        self.lfd = {
            '1m': 29,
            '5m': 59,
            '15m': 59,
            '1h': 59,
            '1d': False,
            '1wk': False,
            '1mo': False
        }

        self.availInterval = lambda: list(self.lfd.keys())

        self.exg = "NSE"

        self.statUrl = 'https://query1.finance.yahoo.com/v8/finance/chart/\
Example #2
0
    def __init__(self, db = None, flush = False, Id = None, level = 'debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self, dumpFile = self.pathMaster['dumps'],
                    logFile = self.pathMaster['logs'],
                    Id = self.Id,
                    level = level)

        self.auth = JSON.load(self.pathMaster['dbConfigs'])['redis']

        self.redisStrcut = JSON.load(self.pathMaster['dbStruct'])['redis']

        self.r = redis.Redis(host = self.auth['host'],
                             port = self.auth['port'],
                             password = self.auth['passWord'],
                             db = self.auth['db'] if db == None else self.redisStrcut[db])

        if flush:

            self.r.flushdb()

        

        self.__setUp__()
Example #3
0
    def __init__(
        self,
        creds,
        Id=None,
        level='debug',
    ):

        uty.__init__(self)

        self.Id = self.getId(Id)

        self.mysql = mysql.connector

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        try:

            self.cnx = self.mysql.connect(user=creds['userName'],
                                          password=creds['passWord'],
                                          host=creds['host'],
                                          port=creds['port'])

            self.cursor = self.cnx.cursor()

        except mysql.connector.errors.ProgrammingError:

            self.eTrace(stamp=self.ts(),
                        assoc=assoc,
                        status="ERROR",
                        reason="Can't connect to database")
Example #4
0
    def __init__(self, allowedSegs=['EQ'], Id=None, level='debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        nse.__init__(self, Id=self.Id, level=level)

        bq.__init__(self, Id=self.Id, level=level)

        redisClient.__init__(self, Id=self.Id, flush=True, db="quote")

        self.db = db(Id=self.Id, level=level)

        self.USER = '******'

        self.exg = "NSE"

        self.exgId = self.nseId()

        self.allowedSegs = allowedSegs
Example #5
0
    def __init__(self, Id = None, level = 'debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        self.level = level

        lv.__init__(self, dumpFile = self.pathMaster['dumps'],
                    logFile = self.pathMaster['logs'],
                    Id = self.Id,
                    level = level)

        

        

        self.masterUrl = 'https://www.nseindia.com/get-quotes/equity?symbol=TCS'

        self.header = {'Host':'www.nseindia.com', 
                        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0',
                        'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 
                        'Accept-Language':'en-US,en;q=0.5', 
                        'Accept-Encoding':'gzip, deflate, br',
                        'DNT':'1', 
                        'Connection':'keep-alive', 
                        'Upgrade-Insecure-Requests':'1',
                        'Pragma':'no-cache',
                        'Cache-Control':'no-cache'}


        self.result = {}
Example #6
0
    def __init__(self, name, Id = None, level = 'level', *args, **kwargs):

        
        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self, dumpFile = self.pathMaster['dumps'],
                    logFile = self.pathMaster['logs'],
                    Id = self.Id,
                    level = level)


        

        self.name = name

        self.state = None

        httpx.Client.__init__(self, *args, **kwargs)

        self.route = {"GET":self.get,
                      "POST":self.post,
                      "PUT":self.put,
                      "DELETE":self.delete}


        self.getStore = lambda: STORE
Example #7
0
    def __init__(self, Id = None, level = 'debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self, dumpFile = self.pathMaster['dumps'],
                    logFile = self.pathMaster['logs'],
                    Id = self.Id,
                    level = level)
Example #8
0
    def __init__(self, Id=None, level='debug'):

        uty.__init__(self)
        self.Id = self.getId(Id)

        self.https = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',
                                         ca_certs=certifi.where())

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)
Example #9
0
    def __init__(self, name, Id = None, level = 'debug', asy = False, **kwargs):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self, dumpFile = self.pathMaster['dumps'],
                    logFile = self.pathMaster['logs'],
                    Id = self.Id,
                    level = level)


        self.name = name
        self.asy = asy
        self.kwargs = kwargs
        self.level = level
Example #10
0
    def __init__(self, Id=None, level='debug', **kwargs):

        uty.__init__(self)

        self.Id = self.getId(Id)

        mDwn.__init__(self, Id=self.Id, level=level)
        dwn.__init__(self, Id=self.Id, level=level)

        self.mRegular([{'url': 'https://www.google.com/', 'enc': 'utf-8'}])

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        self.brokerName = 'samco'

        self.logStatus = False

        self.defExg = 'NSE'

        self.broker = JSON.load(self.pathMaster['brokers_'](self.brokerName +
                                                            '0.json'))

        self.authHeader = {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        }

        self.intervalMap = {
            '1m': 1,
            '5m': 5,
            '10m': 10,
            '15m': 15,
            '30m': 30,
            '1h': 60,
            '1d': None
        }

        self.__runBroker__()

        self.creds = self.__argParse__(kwargs)

        self.__login__()
Example #11
0
    def __init__(self, allowedSegs = ['EQ'], Id = None, level = 'debug'):

        uty.__init__(self)
        self.Id = self.getId(Id)

        lv.__init__(self, dumpFile = self.pathMaster['dumps'],
            logFile = self.pathMaster['logs'],
            Id = self.Id,
            level = level)

        

        dwn.__init__(self, self.Id, level)
        mDwn.__init__(self, self.Id, level)
        nseReq.__init__(self, Id = Id, level = level)

        self.allowedSegs = allowedSegs
Example #12
0
    def __init__(self, creds, Id=None, level='debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        self.Id = self.getId(Id)

        self.creds = creds

        self.poolStatus = False

        self.result = {}
Example #13
0
    def __init__(self, Id=None, level='debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        nse.__init__(self, Id=self.Id, level=level)

        bq.__init__(self, Id=self.Id, level=level)

        self.db = db(Id=self.Id, level=level)

        self.USER = '******'

        self.exg = "NSE"

        self.exgId = self.nseId()
Example #14
0
    def __init__(self, Id=None, level='debug'):

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        bq.__init__(self, Id=self.Id, level=level)

        yahoo.__init__(self, level=level)

        self.db = db(Id=self.Id, level=level)

        self.availIntervals = self.availInterval()

        self.tabName = lambda symbol, interval: f'{symbol}_{interval}'

        self.exg = "NSE"
Example #15
0
    def __init__(self, Id=None, level='debug', **kwargs):
        """
        userName = samco userName
        password = samco passWord
        code     = samco code

        don't disarrage variables variables are position dependent
        
        """

        uty.__init__(self)

        self.Id = self.getId(Id)

        lv.__init__(self,
                    dumpFile=self.pathMaster['dumps'],
                    logFile=self.pathMaster['logs'],
                    Id=self.Id,
                    level=level)

        dwn.__init__(self, Id=self.Id, level=level)

        mDwn.__init__(self, self.Id, level)

        self.brokerName = 'samco'

        self.brokerBase = "https://api.stocknote.com"

        self.logStatus = False

        self.defExg = 'NSE'

        self.broker = JSON.load(self.pathMaster['brokers_'](self.brokerName +
                                                            '0.json'))

        self.checkList = {}

        self.authHeader = {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        }

        self.reqRoute = {
            'GET': self.__GET__,
            'POST': self.__POST__,
            'PUT': self.__PUT__,
            'DELETE': self.__DELETE__
        }

        self.intervalMap = {
            '1m': 1,
            '5m': 5,
            '10m': 10,
            '15m': 15,
            '30m': 30,
            '1h': 60,
            '1d': None
        }

        self.__runBroker__()

        self.creds = self.__argParse__(kwargs)

        self.__login__()