{ "info": { "author": "Adam Sherman", "author_email": "adam.r.sherman@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "*Pytrademonster* is a simple, pythonic interface to TradeMonster/Optionhouses' XML based API. It attempts to cover\nmost of the functionality that their API provides. \n\nAdmittedly, their API documentation is a bit shoddy, but this project\naccounts for that where possible. In order to trade systematically with them there is an account minumum that you must maintain.\n\n*Tested against their API Version 2.5*\n\n*Intended for Python 2.7*\n\nGetting Started\n===============\n::\n\n Choose one:\n 1. Checkout the project here and run 'python setup.py install'\n 2. 'pip install pytrademonster' (use sudo if needed)\n\n|\nExamples (for more, see the unit tests)\n========\n\n**Create an instance of PyTradeMonster and log in**\n\nThe first time this is done, you'll be prompted for your user/pass\nand it will be saved into a default file, 'cred.dat' or one of your choice\n\n.. code-block:: python\n\n from pytrademonster import PyTradeMonster\n pyTradeMonster = PyTradeMonster()\n\n**Get a quote**\n\n.. code-block:: python\n\n from pytrademonster import PyTradeMonster\n from pytrademonster.services import QuotesService\n from pytrademonster.constants import TradeMonsterConstants\n\n pyTradeMonster = PyTradeMonster()\n quotesService = QuotesService(pyTradeMonster)\n\n #add any number of 'ticker:instrumentType' pairs\n symbolDict = {'SPY' : TradeMonsterConstants.INSTRUMENTS.EQUITY}\n quoteResult = quotesService.getParsedQuotes(symbolDict)\n\n**Get an option chain**\n\n.. code-block:: python\n\n from pytrademonster import PyTradeMonster\n from pytrademonster.services import QuotesService\n from pytrademonster.constants import TradeMonsterConstants\n \n pyTradeMonster = PyTradeMonster()\n quotesService = QuotesService(pyTradeMonster)\n \n #get a list of option strikes for various expirations for a single security\n results = quotesService.getParsedOptionChain('SPY')\n \n**Get account information**\n\n.. code-block:: python\n\n from pytrademonster import PyTradeMonster\n from pytrademonster.services import AccountServices\n\n pyTradeMonster = PyTradeMonster()\n accountsService = AccountServices(pyTradeMonster)\n \n # return a dictionary of Account objects that contain useful account information\n accounts = accountsService.getParsedAccountObjects()\n\n\n**Place an equity order**\n\n.. code-block:: python\n\n from pytrademonster import PyTradeMonster\n from pytrademonster.services import OrderServices, AccountServices\n from pytrademonster.objects import LimitOrder, OrderLeg\n from pytrademonster.constants import TradeMonsterConstants\n \n pyTradeMonster = PyTradeMonster()\n\n orderService = OrderServices(pyTradeMonster)\n accountsService = AccountServices(pyTradeMonster)\n \n # get our list of accounts\n accounts = accountsService.getParsedAccountObjects()\n \n ACCOUNT_NUMBER = 'your account number'\n \n # create a simple limit order with a silly price\n order = LimitOrder()\n orderLeg = OrderLeg()\n orderLeg.instrumentType = TradeMonsterConstants.INSTRUMENTS.EQUITY\n orderLeg.symbol = 'SPY'\n orderLeg.orderSide = OrderLeg.side.BUY\n order.price = 0.01\n order.quantity = 1\n order.orderLegs = [orderLeg]\n order.instrumentType = TradeMonsterConstants.INSTRUMENTS.EQUITY\n order.timeInForce = LimitOrder.timeInForceEnum.DAY\n order.marketSession = LimitOrder.marketSessionEnum.REG\n\n # send the order to the trademonster\n orderResponse = orderService.sendOrderAndGetParsedResponse(self.accounts[ACCOUNT_NUMBER], order)\n \n orderId = orderResponse.orderId\n orderStatus = orderResponse.status\n print 'Order {0} status is {1}'.format(orderId,status)\n\n**Place a multi-leg option order**\n\n.. code-block:: python\n \n from pytrademonster import PyTradeMonster\n from pytrademonster.services import OrderServices, AccountServices\n from pytrademonster.objects import LimitOrder, OrderLeg\n from pytrademonster.constants import TradeMonsterConstants\n \n pyTradeMonster = PyTradeMonster()\n\n orderService = OrderServices(pyTradeMonster)\n accountsService = AccountServices(pyTradeMonster)\n \n # get our list of accounts\n accounts = accountsService.getParsedAccountObjects()\n \n ACCOUNT_NUMBER = 'your account number'\n \n # Create a simple buy (debit) spread, by creating each individual leg \n # The symbol and spread name fields should be changed depending on the ticker\n order = LimitOrder()\n shortLeg = OrderLeg()\n longLeg = OrderLeg()\n\n shortLeg.instrumentType = TradeMonsterConstants.INSTRUMENTS.OPTION\n shortLeg.symbol = 'TickerSymbol' #you can look up the ticker using a service or their GUI\n shortLeg.orderSide = OrderLeg.side.SELL\n shortLeg.quantityRatio = 1\n\n longLeg.instrumentType = TradeMonsterConstants.INSTRUMENTS.OPTION\n longLeg.symbol = 'TickerSymbol' #you can look up the ticker using a service or their GUI\n longLeg.orderSide = OrderLeg.side.BUY\n longLeg.quantityRatio = 1\n\n order.price = 0.01\n order.quantity = 1\n order.instrumentType = TradeMonsterConstants.INSTRUMENTS.OPTION\n order.timeInForce = LimitOrder.timeInForceEnum.DAY\n order.marketSession = LimitOrder.marketSessionEnum.REG\n order.orderLegs = []\n order.orderLegs.append(shortLeg)\n order.orderLegs.append(longLeg)\n order.spreadName = TradeMonsterConstants.OrderRequests.ORDER_SPREAD_TYPES.PUT_VERTICAL #if it's a put spread\n\n #send a live order with a silly price\n orderResult = orderService.sendOrderAndGetParsedResponse(self.accounts[ACCOUNT_NUMBER], order)\n\n status = orderResult.status\n print 'Status of order is {0}'.format(status)\n \n \n**Cancel an order**\n\n.. code-block:: python\n \n from pytrademonster import PyTradeMonster\n from pytrademonster.services import OrderServices\n\n pyTradeMonster = PyTradeMonster()\n orderService = OrderServices(pyTradeMonster)\n \n # get the orderId from a recent order first\n # i.e., orderId = orderService.sendOrderAndGetParsedResponse(self.accounts[ACCOUNT_NUMBER], order).orderId\n \n result = orderService.sendCancelOrder(orderId)\n \n \n**Get detailed position information**\n\n.. code-block:: python\n \n from pytrademonster import PyTradeMonster\n from pytrademonster.services import PositionService\n \n pyTradeMonster = PyTradeMonster()\n positionService = PositionService(pyTradeMonster)\n \n # get account id from the account service first if needed\n # this will return a list of existing positions by type and their associated information\n result = positionService.getPositionsDetail(accountId)\n \n\n**Plot your pnl**\n\n.. code-block:: python\n \n from pytrademonster import PyTradeMonster\n from pytrademonster.visualizer import plotAccountPnl\n \n pyTradeMonster = PyTradeMonster()\n accountNumber = 'xxxxxxx' # your account number\n startTime = '20100101T00:00:00'\n endTime = '20150730T00:00:00'\n plotAccountPnl(pyTradeMonster, TradeMonsterConstants.AccountRequests.TRANSACTION_TYPES.TRADE, accountNumber, startTime, endTime, 'AAPL')\n\n\n\nFunctions provided\n==================\nThis tries to be as consistent with their API as possible, but some functions just don't work as described. \nThe coverage is fairly robust, but not a complete representation of their entire API. \n\n::\n \n For more details, look at the XML mappings in *constants.py* as well as the function calls in the services.\n \n\n\nFuture development\n==================\n\nThis is certainly a work in progress, and no guarantees, but feel free to shoot me a note here for anything you'd like to see.\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/adamsherman/pytrademonster", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "pytrademonster", "package_url": "https://pypi.org/project/pytrademonster/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pytrademonster/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/adamsherman/pytrademonster" }, "release_url": "https://pypi.org/project/pytrademonster/0.11/", "requires_dist": null, "requires_python": null, "summary": "Simple wrapper around TradeMonster/Optionhouses' XML based API", "version": "0.11" }, "last_serial": 1652558, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "47fb54c0794145f588d3c9d94f7531fb", "sha256": "8aa5d948c2ae30ee8907f104046d9d0a277fc43b5a4a59849be2e3b90329c89a" }, "downloads": -1, "filename": "pytrademonster-0.1.tar.gz", "has_sig": false, "md5_digest": "47fb54c0794145f588d3c9d94f7531fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20229, "upload_time": "2015-07-28T02:12:34", "url": "https://files.pythonhosted.org/packages/0c/91/af8f655aca6c291fab7bdcf7dd924dee6c95ae38a4e7d31adb1f7948f122/pytrademonster-0.1.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "2845dc84f302246456df985c7cfdba5f", "sha256": "3df851c2a4cc8a1af8cc83237da5814d8e2fa4364d1289971c916d43c9b4407e" }, "downloads": -1, "filename": "pytrademonster-0.11.tar.gz", "has_sig": false, "md5_digest": "2845dc84f302246456df985c7cfdba5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20238, "upload_time": "2015-07-28T02:36:00", "url": "https://files.pythonhosted.org/packages/69/14/3af1415863c2e80ecf0661a36e106b6247256c9325e69b12901eae47eda2/pytrademonster-0.11.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2845dc84f302246456df985c7cfdba5f", "sha256": "3df851c2a4cc8a1af8cc83237da5814d8e2fa4364d1289971c916d43c9b4407e" }, "downloads": -1, "filename": "pytrademonster-0.11.tar.gz", "has_sig": false, "md5_digest": "2845dc84f302246456df985c7cfdba5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20238, "upload_time": "2015-07-28T02:36:00", "url": "https://files.pythonhosted.org/packages/69/14/3af1415863c2e80ecf0661a36e106b6247256c9325e69b12901eae47eda2/pytrademonster-0.11.tar.gz" } ] }