mirror of
https://github.com/wassname/options_backtester.git
synced 2026-09-09 11:28:08 +08:00
14 lines
377 B
Python
14 lines
377 B
Python
import math
|
|
from .portfolio import Portfolio
|
|
|
|
|
|
class SimplePortfolio(Portfolio):
|
|
"""Allocates all capital to the first signal processed"""
|
|
|
|
def __init__(self, *args):
|
|
super().__init__(*args)
|
|
|
|
def _get_allocation(self, strength, price):
|
|
"""Allocates all capital to the given signal"""
|
|
return math.floor(self.current_position["Cash"] / price)
|