Title PageCopyright and CreditsPython Algorithmic Trading CookbookAbout PacktWhy subscribe?ContributorsAbout the authorAbout the reviewersPackt is searching for authors like youPrefaceWho this book is forWhat this book coversTo get the most out of this bookDownload the example code filesDownload the color imagesConventions usedSectionsGetting readyHow to do it…How it works…There's more…See alsoGet in touchReviewsHandling and Manipulating Date, Time, and Time Series DataTechnical requirementsCreating datetime objectsHow to do it…How it works...There's moreCreating timedelta objectsHow to do it…How it works...There's moreOperations on datetime objectsHow to do it…How it works…There's moreModifying datetime objectsHow to do it…How it works...Converting a datetime object to a stringHow to do it…How it works...Creating a datetime object from a stringHow to do it…How it works...There's moreThe datetime object and time zonesHow to do it…How it works...There's moreCreating a pandas.DataFrame objectHow to do it...How it works...There's moreDataFrame manipulation—renaming, rearranging, reversing, and slicingGetting readyHow to do it…How it works...There's moreDataFrame manipulation—applying, sorting, iterating, and concatenatingGetting readyHow to do it…How it works...There's moreConverting a DataFrame into other formatsGetting readyHow to do it…How it works...Creating a DataFrame from other formatsGetting readyHow to do it…How it works...Stock Markets - Primer on TradingTechnical requirementsSetting up Python connectivity with the brokerHow to do it…How it works...Querying a list of instrumentsGetting readyHow to do it…How it works…Fetching an instrumentGetting readyHow to do it…How it works…Querying a list of exchangesGetting readyHow to do it…How it works…Querying a list of segmentsGetting readyHow to do it…How it works…Knowing other attributes supported by the brokerHow to do it…How it works…Placing a simple REGULAR orderGetting readyHow to do it…How it works…Placing a simple BRACKET orderGetting readyHow to do it…How it works…Placing a simple DELIVERY orderGetting readyHow to do it…How it works…Placing a simple INTRADAY orderGetting readyHow to do it…How it works…Querying margins and fundsGetting readyHow to do it…How it works…Calculating the brokerage chargedHow to do it…How it works…Calculating the government taxes chargedHow to do it…How it works…Fetching Financial DataTechnical requirementsFetching the list of financial instrumentsGetting readyHow to do it…How it works…Attributes of a financial instrumentGetting readyHow to do it…How it works…Expiry of financial instrumentsGetting readyHow to do it…How it works…Circuit limits of a financial instrumentGetting readyHow to do it…How it works…The market depth of a financial instrumentGetting readyHow to do it…How it works…The total pending buy quantity of a financial instrumentGetting readyHow to do it…How it works…The total pending sell quantity of a financial instrumentGetting readyHow to do it…How it works…The total volume traded for the day of a financial instrumentGetting readyHow to do it…How it works…The last traded price of a financial instrumentGetting readyHow to do it…How it works…The last traded time of a financial instrumentGetting readyHow to do it…How it works…The last traded quantity of a financial instrumentGetting readyHow to do it…How it works…The recorded open price of the day of a financial instrumentGetting readyHow to do it…How it works…The recorded highest price of the day of a financial instrumentGetting readyHow to do it…How it works…The recorded lowest price of the day of a financial instrumentGetting readyHow to do it…How it works…The recorded close price of the last traded day of a financial instrumentGetting readyHow to do it…How it works…Computing Candlesticks and Historical DataTechnical requirementsFetching historical data using the broker APIGetting readyHow to do it…How it works…Fetching historical data using the Japanese (OHLC) candlestick patternGetting readyHow to do it…How it works…Fetching the Japanese candlestick pattern with variations in candle intervalsGetting readyHow to do it…How it works…Fetching historical data using the Line Break candlestick patternGetting readyHow to do it…How it works…Fetching historical data using the Renko candlestick patternGetting readyHow to do it…How it works…Fetching historical data using the Heikin-Ashi candlestick patternGetting readyHow to do it…How it works…Fetching historical data using QuandlGetting readyHow to do it…How it works…Computing and Plotting Technical IndicatorsTechnical requirementsTrend indicators – simple moving averageGetting startedHow to do it…How it works...Trend indicators – exponential moving averageGetting startedHow to do it…How it works…Trend indicators – moving average convergence divergenceGetting startedHow to do it…How it works…Trend indicators – parabolic stop and reverseGetting startedHow to do it…How it works…Momentum indicators – relative strength indexGetting startedHow to do it…How it works…Momentum indicators – stochastic oscillatorGetting startedHow to do it…How it works…Volatility indicators – Bollinger BandsGetting startedHow to do it…How it works…Volatility indicators – average true rangeGetting startedHow to do it…How it works…Volume indicators – on balance volumeGetting startedHow to do it…How it works…Volume indicators – volume-weighted average priceGetting startedHow to do it…How it works…Placing Regular Orders on the ExchangeTechnical requirementsPlacing a regular market orderGetting readyHow to do it…How it works…Placing a regular limit orderGetting readyHow to do it...How it works...Placing a regular stoploss-limit orderGetting ready...How to do it…How it works…Placing a regular stoploss-market orderGetting readyHow to do it…How it works…Placing Bracket and Cover Orders on the ExchangeTechnical requirementsPlacing a bracket limit orderGetting readyHow to do it…How it works…There's more…Placing a bracket stoploss-limit orderGetting readyHow to do it…How it works…Placing a bracket limit order with trailing stoplossGetting readyHow to do it…How it works...Placing a bracket stoploss-limit order with trailing stoplossGetting readyHow to do it…How it works...Placing a cover market orderGetting readyHow to do it…How it works...Placing a cover limit orderGetting readyHow to do it…How it works...Algorithmic Trading Strategies - Coding Step by StepTechnical requirementsEMA-Regular-Order strategy – coding the __init__, initialize, name, and versions_supported methodsGetting readyHow to do it…How it works…EMA-Regular-Order strategy – coding the strategy_select_instruments_for_entry methodGetting readyHow to do it…How it works…EMA-Regular-Order strategy – coding the strategy_enter_position methodGetting readyHow to do it…How it works…EMA-Regular-Order strategy – coding the strategy_select_instruments_for_exit methodGetting readyHow to do it…How it works…EMA-Regular-Order strategy – coding the strategy_exit_position methodGetting readyHow to do it…How it works…EMA-Regular-Order strategy – uploading the strategy on the AlgoBulls trading platformGetting readyHow to do it…How it works…There's more…MACD-Bracket-Order strategy – coding the __init__, initialize, name, and versions_supported methodsGetting readyHow to do it…How it works…MACD-Bracket-Order strategy – coding the strategy_select_instruments_for_entry methodGetting readyHow to do it…How it works…MACD-Bracket-Order strategy – coding the strategy_enter_position methodGetting readyHow to do it…How it works…MACD-Bracket-Order strategy – coding the strategy_select_instruments_for_exit methodGetting readyHow to do it…How it works…MACD-Bracket-Order strategy – coding the strategy_exit_position methodGetting readyHow to do it…How it works…MACD-Bracket-Order strategy — uploading the strategy on the AlgoBulls trading platformGetting readyHow to do it…How it works…There's more…Algorithmic Trading - BacktestingTechnical requirementsEMA-Regular-Order strategy – fetching the strategyHow to do it…How it works…EMA-Regular-Order strategy – backtesting the strategyGetting readyHow to do it…How it works…There's more…EMA-Regular-Order strategy – fetching backtesting logs in real timeGetting readyHow to do it…How it works…There's more...EMA-Regular-Order strategy – fetching a backtesting report – profit and loss tableGetting readyHow to do it…How it works…There's more...EMA-Regular-Order strategy — fetching a backtesting report – statistics tableGetting readyHow to do it…How it works…There's more...EMA-Regular-Order strategy – fetching a backtesting report – order historyGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching the strategyHow to do it…How it works…MACD-Bracket-Order strategy – backtesting the strategyGetting readyHow to do it…How it works…There's more…MACD-Bracket-Order strategy – fetching backtesting logs in real timeGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching a backtesting report – profit and loss tableGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching a backtesting report – statistics tableGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching a backtesting report – order historyGetting readyHow to do it…How it works…There's more...Algorithmic Trading - Paper TradingTechnical requirementsEMA-Regular-Order strategy – fetching the strategyHow to do it…How it works…EMA-Regular-Order strategy – paper trading the strategyGetting readyHow to do it…How it works…There's more…EMA-Regular-Order strategy – fetching paper trading logs in real timeGetting readyHow to do it…How it works…There's more...EMA-Regular-Order strategy – fetching a paper trading report – profit and loss tableGetting readyHow to do it…How it works…There's more...EMA-Regular-Order strategy – fetching a paper trading report – statistics tableGetting readyHow to do it…How it works…There's more...EMA-Regular-Order strategy – fetching a paper trading report – order historyGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching the strategyHow to do it…How it works…MACD-Bracket-Order strategy – paper trading the strategyGetting readyHow to do it…How it works…There's more…MACD-Bracket-Order strategy – fetching paper trading logs in real timeGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching a paper trading report – profit and loss tableGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching a paper trading report – statistics tableGetting readyHow to do it…How it works…There's more...MACD-Bracket-Order strategy – fetching a paper trading report – order historyGetting readyHow to do it…How it works…There's more...Algorithmic Trading - Real TradingTechnical requirementsEMA–Regular–Order strategy – fetching the strategyHow to do it…How it works…EMA–Regular–Order strategy – real trading the strategyGetting readyHow to do it…How it works…There's more…EMA–Regular–Order strategy – fetching real trading logs in real timeGetting readyHow to do it…How it works…There's more...EMA–Regular–Order strategy – fetching a real trading report – profit and loss tableGetting readyHow to do it…How it works…There's more...EMA–Regular–Order strategy – fetching a real trading report – statistics tableGetting readyHow to do it…How it works…There's more...MACD–Bracket–Order strategy – fetching the strategyHow to do it…How it works…MACD–Bracket–Order strategy – real trading the strategyGetting readyHow to do it…How it works…There's more…MACD–Bracket–Order strategy – fetching real trading logs in real timeGetting readyHow to do it…How it works…There's more...MACD–Bracket–Order strategy – fetching a real trading report – profit and loss tableGetting readyHow to do it…How it works…There's more...MACD–Bracket–Order strategy – fetching a real trading report – statistics tableGetting readyHow to do it…How it works…There's more...Appendix ISetting up your Zerodha accountOpening a Zerodha account onlineLogging in to the Zerodha trading platform websiteSetting up your Zerodha Developer Options accountLogging in to the Zerodha Developer Options websitePurchasing and enabling the Zerodha Developer Options APITesting API keys and authorizing the app by firing your first API callAppendix IISetting up your AlgoBulls accountRegistering on the AlgoBulls platformLogging in to the AlgoBulls websiteFetching your AlgoBulls Developer Options tokenSetting up your AlgoBulls accountAppendix IIIDeveloping and improving strategiesStrategy profitability is subject to seasonsStrategy profitability is subject to its parameter valuesBacktesting alone does not ensure strategy profitabilityBroker limitationsStaying connected with the communityBe prepared for technology failures during actual tradingOther Books You May EnjoyLeave a review - let other readers know what you think