Package: trade-trails
Trade-TrailsIn this library you will find TradeTrails company Function which is often used in Codes.Package InstallationFor installing this library you can use any python compiler or you can  openCMDand install  python 3.6 version or the above version.Use the following syntx to install the function:-pip install trade-trails==0.0.1Package ImportThis import package is for installing all the packagefrom trade_trails import *FunctionsFollowing are the given functions to fetch the required data :-Future Close PriceCall PricePut PriceNearest Base PriceBest Of ThreeSell Stop LossBuy Stop LossFile NameFuture Close PriceThis function is use to fetch  close price at the  given time .Time should be in a string andHH:MM:SSDataframe should beFUTURE DATAImport Packagefrom trade_trails import FutureCloseSyntaxFutureClose.close_price(self, time, dataframe)Example -Input:Time = "09:20:59"df =  Variabledfshould contain a dataframeCODEfrom trade_trails import FutureClose



data = FutureClose.close_price(time=Time, dataframe=df) 

print(data)Output :34661.45ATM (At The Money)This function used to find At The Money Strike , Call Price and Put PriceTime should be in a string andHH:MM:SSDataframe should beOPTION DATAImport Packagefrom trade_trails import OptionDataSyntaxOptionData(self, dataframe, times).atm()Example-Input:Time = "09:20:59"df =  Variabledfshould contain a dataframeCODEfrom trade_trails import OptionData



atm = OptionData(dataframe=df, time=times).atm() 

print(atm)Output :[{'atm': '31400', 'call_atm_price': 395.05, 'put_atm_price': 427.2}]CALL PRICEIt returns call close price at the given time and given strike of OPTION DATATime should be in a string andHH:MM:SSDataframe should beOPTION DATAStrike should be a stringImport Packagefrom trade_trails import OptionDataSyntaxOptionData(self, dataframe, time, strike).call_price()Example-Input:df =  Variabledfshould contain a dataframeTime = "09:20:59"Strike= "31400"CODE:from trade_trails import OptionData



call_price = OptionData(dataframe=df, time=Time, strike=Strike).call_price() 

print(call_price)Output :395.05PUT PRICEIt returns put close price at the given time and given strike of OPTION DATATime should be in a string andHH:MM:SSDataframe should beOPTION DATAStrike should be a stringImport Packagefrom trade_trails import OptionDataSyntaxOptionData(self, dataframe, time, strike).put_price()Example-Input:df =  Variabledfshould contain a dataframeTime = "09:20:59"Strike= "31400"CODE:from trade_trails import OptionData



put_price = OptionData(dataframe=df, time=Time, strike=Strike).put_price() 

print(put_price)Output :427.02Nearest Base PriceIt returns  close price and strike of nearest base price by using time , base price and optiontype as input of OPTION DATADataframe should beOPTION DATATime should be in a string andHH:MM:SSBase Price should be an integerOption type (CE/PE) should be string  (Default Value = CE)Import Packagefrom trade_trails import OptionDataSyntaxOptionData(self, dataframe,, time, base_price, option_type).nearest_base_price()Example-Input:df =  Variabledfshould contain a dataframeTime = "09:20:59"Base_Price = 250Option_Type = "PE/CE"CODE:from trade_trails import OptionData



nearest_base_price = OptionData(dataframe=df, time=Time, base_price=Base_Price, option_type=Option_Type).nearest_base_price() 

print(nearest_base_price)Output :[{'nearest_base_price': 263.1, 'nearest_base_price_strike': '31700'}]Best Of ThreeIt returnsEntry PriceandEntry Strikefrom best three combination by using Time and Base price ofOPTION DATADataframe should beOPTION DATATime should be in a string andHH:MM:SSBase Price should be an integerImport Packagefrom trade_trails import OptionDataSyntaxOptionData(self, dataframe, time, base_price).best_of_three()Example-Input:df =  Variabledfshould contain a dataframeTime = "09:20:59"Base_Price = 250CODE:from trade_trails import OptionData



best_of_three = OptionData(dataframe=df, time=Time, base_price=Base_Price).best_of_three() 

print(best_of_three)Output :[{'call_strike': '31700', 'call_entry_price': 263.1, 'put_strike': '31000', 'put_entry_price': 260.65}]Sell Stop LossIt will returnsExit PriceandExit Timewhen it will hit the stop loss for sell strategy by using Entry time, Exit time, Option type, Streike, Stop Loss Price and OPTION DATADataframe should beOPTION DATAEntry Time should be in a string andHH:MM:SSExit Time should be in a string andHH:MM:SSOption type (CE/PE) should be string (Default Value = CE)Strike should be a stringStop Loss Price should be floatImport Packagefrom trade_trails import OptionDataSyntaxStopLoss(self, dataframe, entry_time, exit_time, option_type, strike, stoploss_price).sell_stop_loss()Example-Input:df =  Variabledfshould contain a dataframeEntry_Time = "09:20:59"Exit_Time = "15:20:59"Option_Type = "PE/CE"Strike= "31400"Stop_Loss_Price = 294.5CODE:from trade_trails import OptionData



sell_stop_loss = StopLoss(dataframe=df, entry_time=Entry_Time, exit_time=Exit_Time, option_type=Option_Type, strike=Strike, stoploss_price=Stop_Loss_Price).sell_stop_loss() 

print(sell_stop_loss)Output :[{'CE_exit_time': datetime.time(10, 23, 59), 'CE_exit_price': 294.5}]Buy Stop LossIt will returnsExit PriceandExit Timewhen it will hit the stop loss for buy strategy by using Entry time, Exit time, Option type, Streike, Stop Loss Price and OPTION DATADataframe should beOPTION DATAEntry Time should be in a string andHH:MM:SSExit Time should be in a string andHH:MM:SSOption type (CE/PE) should be string (Default Value = CE)Strike should be a stringStop Loss Price should be floatImport Packagefrom trade_trails import OptionDataSyntaxStopLoss(self, dataframe, entry_time, exit_time, option_type, strike, stoploss_price).buy_stop_loss()Example-Input:df =  Variabledfshould contain a dataframeEntry_Time = "09:20:59"Exit_Time = "15:20:59"Option_Type = "PE/CE"Strike= "31400"Stop_Loss_Price = 294.5CODE:from trade_trails import OptionData



buy_stop_loss = StopLoss(dataframe=df, entry_time=Entry_Time, exit_time=Exit_Time, option_type=Option_Type, strike=Strike, stoploss_price=Stop_Loss_Price).buy_stop_loss() 

print(sell_stop_loss)Output :[{'PE_exit_time': datetime.time(15, 20, 59), 'PE_exit_price': 200}]File NameIt will give file name, year and month  format which is stored in the database which you can use for creating pathInstrument should be string which contain trading symbol   (Default - "BANKNIFTY")Date should be in string (YYYY-MM-DD)Import Packagefrom trade_trails import FileNameSyntaxFileName(self, date, instrument).filename()Example-Input:Date = "2020-03-01"Instrument = "NIFTY"CODE:from trade_trails import FileName



filename = FileName(date=Date, instrument=Instrument).filename() 

print(filename)Output :{'filename': 'NIFTY_01032020.pkl', 'year': 2020, 'month': 3}]