This Library is only For Trade Trails Company
Project description
Trade-Trails
In this library you will find TradeTrails company Function which is often used in Codes.
Package Installation
For installing this library you can use any python compiler or you can open CMD and install python 3.6 version or the above version.
Use the following syntx to install the function:-
pip install trade-trails==0.0.1
Package Import
This import package is for installing all the package
from trade_trails import *
Functions
Following are the given functions to fetch the required data :-
Future Close Price
This function is use to fetch close price at the given time .
-
Time should be in a string and HH:MM:SS
-
Dataframe should be FUTURE DATA
Import Package
from trade_trails import FutureClose
Syntax
FutureClose.close_price(self, time, dataframe)
Example -
-
Input:
Time = "09:20:59"
df = Variable df should contain a dataframe
CODE
from trade_trails import FutureClose
data = FutureClose.close_price(time=Time, dataframe=df)
print(data)
-
Output :
34661.45
ATM (At The Money)
This function used to find At The Money Strike , Call Price and Put Price
-
Time should be in a string and HH:MM:SS
-
Dataframe should be OPTION DATA
Import Package
from trade_trails import OptionData
Syntax
OptionData(self, dataframe, times).atm()
Example-
-
Input:
Time = "09:20:59"
df = Variable df should contain a dataframe
CODE
from 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 PRICE
It returns call close price at the given time and given strike of OPTION DATA
-
Time should be in a string and HH:MM:SS
-
Dataframe should be OPTION DATA
-
Strike should be a string
Import Package
from trade_trails import OptionData
Syntax
OptionData(self, dataframe, time, strike).call_price()
Example-
-
Input:
df = Variable df should contain a dataframe
Time = "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.05
PUT PRICE
It returns put close price at the given time and given strike of OPTION DATA
-
Time should be in a string and HH:MM:SS
-
Dataframe should be OPTION DATA
-
Strike should be a string
Import Package
from trade_trails import OptionData
Syntax
OptionData(self, dataframe, time, strike).put_price()
Example-
-
Input:
df = Variable df should contain a dataframe
Time = "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.02
Nearest Base Price
It returns close price and strike of nearest base price by using time , base price and option
type as input of OPTION DATA
-
Dataframe should be OPTION DATA
-
Time should be in a string and HH:MM:SS
-
Base Price should be an integer
-
Option type (CE/PE) should be string (Default Value = CE)
Import Package
from trade_trails import OptionData
Syntax
OptionData(self, dataframe,, time, base_price, option_type).nearest_base_price()
Example-
-
Input:
df = Variable df should contain a dataframe
Time = "09:20:59"
Base_Price = 250
Option_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 Three
It returns Entry Price and Entry Strike from best three combination by using Time and Base price of OPTION DATA
-
Dataframe should be OPTION DATA
-
Time should be in a string and HH:MM:SS
-
Base Price should be an integer
Import Package
from trade_trails import OptionData
Syntax
OptionData(self, dataframe, time, base_price).best_of_three()
Example-
-
Input:
df = Variable df should contain a dataframe
Time = "09:20:59"
Base_Price = 250
CODE:
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 Loss
It will returns Exit Price and Exit Time when it will hit the stop loss for sell strategy by using Entry time, Exit time, Option type, Streike, Stop Loss Price and OPTION DATA
-
Dataframe should be OPTION DATA
-
Entry Time should be in a string and HH:MM:SS
-
Exit Time should be in a string and HH:MM:SS
-
Option type (CE/PE) should be string (Default Value = CE)
-
Strike should be a string
-
Stop Loss Price should be float
Import Package
from trade_trails import OptionData
Syntax
StopLoss(self, dataframe, entry_time, exit_time, option_type, strike, stoploss_price).sell_stop_loss()
Example-
-
Input:
df = Variable df should contain a dataframe
Entry_Time = "09:20:59"
Exit_Time = "15:20:59"
Option_Type = "PE/CE"
Strike= "31400"
Stop_Loss_Price = 294.5
CODE:
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 Loss
It will returns Exit Price and Exit Time when it will hit the stop loss for buy strategy by using Entry time, Exit time, Option type, Streike, Stop Loss Price and OPTION DATA
-
Dataframe should be OPTION DATA
-
Entry Time should be in a string and HH:MM:SS
-
Exit Time should be in a string and HH:MM:SS
-
Option type (CE/PE) should be string (Default Value = CE)
-
Strike should be a string
-
Stop Loss Price should be float
Import Package
from trade_trails import OptionData
Syntax
StopLoss(self, dataframe, entry_time, exit_time, option_type, strike, stoploss_price).buy_stop_loss()
Example-
-
Input:
df = Variable df should contain a dataframe
Entry_Time = "09:20:59"
Exit_Time = "15:20:59"
Option_Type = "PE/CE"
Strike= "31400"
Stop_Loss_Price = 294.5
CODE:
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 Name
It will give file name, year and month format which is stored in the database which you can use for creating path
-
Instrument should be string which contain trading symbol (Default - "BANKNIFTY")
-
Date should be in string (YYYY-MM-DD)
Import Package
from trade_trails import FileName
Syntax
FileName(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}]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trade_trails-0.0.2-py3-none-any.whl.
File metadata
- Download URL: trade_trails-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bb5f80d8b4dcbdd00a1571818b25b120049bb66f65a24851b2a345f54f15cae
|
|
| MD5 |
61a069f096aa79cba74ca68a842314cb
|
|
| BLAKE2b-256 |
bacc9fc9c55320e6972d230880aaeda195773c91eb0d50c08f381f27996c13c2
|