mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-20 12:10:30 +08:00
ENH: Allow for stock dividends, and in particular, Google's
recent 2 for 1 stock split, where 1 class C share was distributed for each share of class A held. Now a dividend can specify a sid and ratio of stock that will be paid to owners of the original security. If the ratio is 2.0, then for every existing share, two shares will be paid.
This commit is contained in:
@@ -138,10 +138,11 @@ def create_dividend(sid, payment, declared_date, ex_date, pay_date):
|
||||
'sid': sid,
|
||||
'gross_amount': payment,
|
||||
'net_amount': payment,
|
||||
'dt': declared_date.replace(hour=0, minute=0, second=0, microsecond=0),
|
||||
'ex_date': ex_date.replace(hour=0, minute=0, second=0, microsecond=0),
|
||||
'pay_date': pay_date.replace(hour=0, minute=0, second=0,
|
||||
microsecond=0),
|
||||
'payment_sid': None,
|
||||
'ratio': None,
|
||||
'dt': pd.tslib.normalize_date(declared_date),
|
||||
'ex_date': pd.tslib.normalize_date(ex_date),
|
||||
'pay_date': pd.tslib.normalize_date(pay_date),
|
||||
'type': DATASOURCE_TYPE.DIVIDEND,
|
||||
'source_id': 'MockDividendSource'
|
||||
})
|
||||
@@ -149,6 +150,22 @@ def create_dividend(sid, payment, declared_date, ex_date, pay_date):
|
||||
return div
|
||||
|
||||
|
||||
def create_stock_dividend(sid, payment_sid, ratio, declared_date,
|
||||
ex_date, pay_date):
|
||||
return Event({
|
||||
'sid': sid,
|
||||
'payment_sid': payment_sid,
|
||||
'ratio': ratio,
|
||||
'net_amount': None,
|
||||
'gross_amount': None,
|
||||
'dt': pd.tslib.normalize_date(declared_date),
|
||||
'ex_date': pd.tslib.normalize_date(ex_date),
|
||||
'pay_date': pd.tslib.normalize_date(pay_date),
|
||||
'type': DATASOURCE_TYPE.DIVIDEND,
|
||||
'source_id': 'MockDividendSource'
|
||||
})
|
||||
|
||||
|
||||
def create_split(sid, ratio, date):
|
||||
return Event({
|
||||
'sid': sid,
|
||||
|
||||
Reference in New Issue
Block a user