import pandas as pd
import datetime
import numpy as np
import random

class riskManager:
    
    def __init__(self,commision=0.04):
        self.commision = commision
        pass
    def getDecision(self,probabilityDecision, price, deals=None) -> dict:
        ans = {}
        ans['decision'] = 'none'
        if probabilityDecision['trande'] == 'up':
            ans['decision'] = 'buy'
            ans['amount'] = 1
        elif probabilityDecision['trande'] == 'none':
            ans['decision'] = 'none'
        elif probabilityDecision['trande'] == 'down': 
            for i in range(deals.shape[0]):
                ans['decision'] = 'None'
                ans['deals'] = []
                row = deals.iloc[i]
                if row.startPrice < price*pow(1+self.commission,2):
                    ans['decision'] = 'sell'
                    ans['deals'].append(row.name)
        return ans
        
    
