Adds Rebate and Fee Rates to Shortable Provider (#7840)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Adds Rebate and Fee Rates to Shortable Provider If the provider does have this information, the rates are zero. * Adds Helper Methods to QCAlgorithm - Improve summaries. - Express values as rates instead of percentages. - Adds headers to files to emulate real data * Clarify the Data Format * Removes Helper Methods from QCAlgorithm * Removes `Shortable` and `ShortableQuantity` from Example Algorithms should prefer getting the information from the `Security.ShortableProvider`.
This commit is contained in:
committed by
GitHub
parent
b89d7d65b2
commit
44c7dbd698
@@ -38,8 +38,19 @@ class CustomShortableProviderRegressionAlgorithm(QCAlgorithm):
|
||||
orderQuantity = self.Transactions.GetOrderById(self.orderId).Quantity
|
||||
if orderQuantity != -1001:
|
||||
raise Exception("Quantity of order " + str(_orderId) + " should be " + str(-1001)+", but was {orderQuantity}")
|
||||
|
||||
fee_rate = self.spy.ShortableProvider.FeeRate(self.spy.Symbol, self.Time)
|
||||
if fee_rate != 0.0025:
|
||||
raise Exception(f"Fee rate should be 0.0025, but was {fee_rate}")
|
||||
rebate_rate = self.spy.ShortableProvider.RebateRate(self.spy.Symbol, self.Time)
|
||||
if rebate_rate != 0.0507:
|
||||
raise Exception(f"Rebate rate should be 0.0507, but was {rebate_rate}")
|
||||
|
||||
class CustomShortableProvider(NullShortableProvider):
|
||||
def FeeRate(self, symbol: Symbol, localTime: DateTime):
|
||||
return 0.0025
|
||||
def RebateRate(self, symbol: Symbol, localTime: DateTime):
|
||||
return 0.0507
|
||||
def ShortableQuantity(self, symbol: Symbol, localTime: DateTime):
|
||||
if localTime < datetime(2013,10,5):
|
||||
return 10
|
||||
|
||||
Reference in New Issue
Block a user