Exemple #1
0
 def __init__(self, underlingSymbol = None, tradeTime = None, symbol = None, expirationDate = None, daysToExpiration = None, date = None, optionType = None, strikePrice = None, askPrice = None, bidDate = None, bidPrice = None,
              openPrice = None, highPrice = None, lowPrice = None, lastPrice = None, priceChange = None, volatility = None, theoretical = None, delta = None,
              gamma = None, rho = None, theta = None, vega = None, openInterest = None, volume = None):
     BaseEntity.__init__(self)
     self.underlingSymbol = underlingSymbol
     self.tradeTime = tradeTime
     self.symbol = symbol
     self.expirationDate = expirationDate
     self.date = date
     self.daysToExpiration = daysToExpiration
     self.optionType = optionType
     self.strikePrice = strikePrice
     self.askPrice = askPrice
     self.bidDate = bidDate
     self.bidPrice = bidPrice
     self.openPrice = openPrice
     self.highPrice = highPrice
     self.lowPrice = lowPrice
     self.lastPrice = lastPrice
     self.priceChange = priceChange
     self.volatility = volatility
     self.theoretical = theoretical
     self.delta = delta
     self.gamma = gamma
     self.rho = rho
     self.theta = theta
     self.vega = vega
     self.openInterest = openInterest
     self.volume = volume
Exemple #2
0
    def __init__(self,package_name,date,cinfo=None):
        self.package_name=package_name
        #self.campaign_id=cinfo['campaign_id']
        self.date=date
        self.cinfo=cinfo

        BaseEntity.expire_time=3600*24*7
        BaseEntity.__init__(self,"camp_list:%s:%s" % (package_name,date))
Exemple #3
0
 def loads(dic):
     equity = Equity()
     for k, v in dic.items():
         setattr(equity, k, BaseEntity.fix_na(v))
     BaseEntity.parse_for_entity(BaseEntity.parse_float, equity, [
         'openPrice', 'highPrice', 'lowPrice', 'lastPrice', 'priceChange',
         'volume'
     ])
     BaseEntity.parse_for_entity(BaseEntity.parse_date, equity,
                                 ['tradeTime'])
     return equity
Exemple #4
0
 def loads(dic):
     vix = VIX()
     for k, v in dic.items():
         setattr(vix, k, BaseEntity.fix_na(v))
     BaseEntity.parse_for_entity(BaseEntity.parse_float, vix, [
         'lastPrice', 'priceChange', 'openPrice', 'highPrice', 'lowPrice',
         'previousPrice', 'volume', 'dailyLastPrice', 'dailyPriceChange',
         'dailyOpenPrice', 'dailyHighPrice', 'dailyLowPrice',
         'dailyPreviousPrice', 'dailyVolume'
     ])
     BaseEntity.parse_for_entity(BaseEntity.parse_date, vix,
                                 ['dailyDate1dAgo'])
     return vix
Exemple #5
0
 def __init__(self,
              symbol=None,
              tradeTime=None,
              openPrice=None,
              highPrice=None,
              lowPrice=None,
              lastPrice=None,
              priceChange=None,
              volume=None):
     BaseEntity.__init__(self)
     self.symbol = symbol
     self.tradeTime = tradeTime
     self.openPrice = openPrice
     self.highPrice = highPrice
     self.lowPrice = lowPrice
     self.lastPrice = lastPrice
     self.priceChange = priceChange
     self.volume = volume
Exemple #6
0
 def __init__(self,
              symbol=None,
              lastPrice=None,
              priceChange=None,
              openPrice=None,
              highPrice=None,
              lowPrice=None,
              previousPrice=None,
              volume=None,
              tradeTime=None,
              dailyLastPrice=None,
              dailyPriceChange=None,
              dailyOpenPrice=None,
              dailyHighPrice=None,
              dailyLowPrice=None,
              dailyPreviousPrice=None,
              dailyVolume=None,
              dailyDate1dAgo=None):
     BaseEntity.__init__(self)
     self.symbol = symbol
     self.lastPrice = lastPrice
     self.priceChange = priceChange
     self.openPrice = openPrice
     self.highPrice = highPrice
     self.lowPrice = lowPrice
     self.previousPrice = previousPrice
     self.volume = volume
     self.tradeTime = tradeTime
     self.dailyLastPrice = dailyLastPrice
     self.dailyPriceChange = dailyPriceChange
     self.dailyOpenPrice = dailyOpenPrice
     self.dailyHighPrice = dailyHighPrice
     self.dailyLowPrice = dailyLowPrice
     self.dailyPreviousPrice = dailyPreviousPrice
     self.dailyVolume = dailyVolume
     self.dailyDate1dAgo = dailyDate1dAgo
Exemple #7
0
 def loads(dic):
     option = Option()
     for k, v in dic.items():
         setattr(option, k, BaseEntity.fix_na(v))
     BaseEntity.parse_for_entity(BaseEntity.parse_float, option, ['strikePrice', 'askPrice', 'bidPrice', 'openPrice', 'highPrice', 'lowPrice', 'lastPrice', 'priceChange', 'theoretical', 'delta', 'gamma', 'rho', 'theta', 'vega', 'openInterest', 'volume'])
     BaseEntity.parse_for_entity(BaseEntity.parse_date, option, ['tradeTime', 'expirationDate', 'date', 'bidDate'])
     if option.volatility is not None:
         option.volatility = BaseEntity.parse_float(option.volatility.replace('%', ''))
     # else:
         # print option
     return option
Exemple #8
0
    def get(self,isRedisOnly=False):
        raw_val=self.r.get(self.key)

        if raw_val is not None and raw_val!="null":
            val=json.loads(raw_val)

            today=(datetime.today().replace(hour=0,minute=0,second=0,microsecond=0)-timedelta(days=1))

            last_day=datetime.strptime(val['last_day'],"%Y-%m-%d")

            #print today,last_day
            if last_day<today:
                new_hist=self.update_from_db(val['last_day'])
                val['hist'].update(new_hist['hist'])
                val['last_day']=new_hist['last_day']
        else:
            val=BaseEntity.get(self, isRedisOnly)

        return val
Exemple #9
0
 def __init__(self,date):
     self.date=date
     self.expire_time=3600*24
     BaseEntity.__init__(self,"appid_list_active:%s" % date)
Exemple #10
0
 def __init__(self,app_id):
     self.app_id=app_id
     BaseEntity.__init__(self,"appid_description:%s" % (app_id))
Exemple #11
0
 def __init__(self,app_id,date):
     self.date=date
     self.expire_time=3600*24*60
     self.app_id=app_id
     BaseEntity.__init__(self,"appid_version_to_date:%s:%s" % (app_id,date))
Exemple #12
0
 def __init__(self,appid,date1,date2):
     self.date1=date1
     self.date2=date2
     self.expire_time=3600*24*60
     self.app_id=appid
     BaseEntity.__init__(self,"appid_day_coverage:%s:%s:%s" % (appid,date1,date2))
Exemple #13
0
 def __init__(self,appid,date):
     self.date=date
     self.expire_time=3600*24*60
     self.app_id=appid
     BaseEntity.__init__(self,"appid_active_hist:%s:%s" % (appid,date))
Exemple #14
0
 def __init__(self,date):
     self.date=date
     BaseEntity.expire_time=3600*24*60
     BaseEntity.__init__(self,"date_report:%s" % date)
Exemple #15
0
 def __init__(self,date):
     self.date=date
     BaseEntity.__init__(self,"date_country_report:%s" % (date))
Exemple #16
0
 def __init__(self,date):
     self.date=date
     BaseEntity.expire_time=3600*24*7
     BaseEntity.__init__(self,"offer_active_list:%s" % date)
Exemple #17
0
 def __init__(self,appid,date):
     self.appid=appid
     self.date=date
     BaseEntity.__init__(self,"appid_report:%s:%s" % (appid,date))
Exemple #18
0
 def __str__(self):
     return BaseEntity.to_json(self)
Exemple #19
0
 def __init__(self,offer_id,date):
     self.offer_id=offer_id
     self.date=date
     BaseEntity.expire_time=3600*24*7
     BaseEntity.__init__(self,"offer_report:%s:%s" % (offer_id,date))
Exemple #20
0
 def __init__(self,hour):
     self.hour=hour
     BaseEntity.expire_time=3600*48
     BaseEntity.__init__(self,"daily_report:%s" % hour)
Exemple #21
0
 def __init__(self,date):
     self.date=date
     BaseEntity.expire_time=3600*24*45
     BaseEntity.__init__(self,"daily_revenue:%s" % date)
Exemple #22
0
 def __init__(self,date,appid):
     self.date=date
     self.appid=appid
     BaseEntity.expire_time=3600*24*60
     BaseEntity.__init__(self,"date_report:%s:%s" % (date,appid))