pproapi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pproapi [2013/06/21 17:20] – sheng | pproapi [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **This work is licensed under a [[http:// | ||
- | ====== PProAPI ====== | ||
- | |||
- | |||
- | **Overview** | ||
- | |||
- | The Ppro API is a web service that will provide information to communicate with third party applications using a XML file to allow trading, when the API is turn on in the toolbar of Ppro 8. | ||
- | |||
- | Through the PPro8 toolbar, the user will be able to turn the switch to start or stop the web service that will provide information to communicate with third party applications using a XML file. | ||
- | |||
- | The user will be able to go for Main API Portal using the follow link: http:// | ||
- | |||
- | {{ : | ||
- | |||
- | =====4. API Request Commands===== | ||
- | |||
- | The API provides web service to use different syntax and execute the commands giving information to the user. | ||
- | |||
- | **4.01 Register a symbol** | ||
- | |||
- | * Request Type: RegisterSymbol | ||
- | * Parameters: | ||
- | * * symbol | ||
- | * * feedType[Lv1, | ||
- | |||
- | **4.02 Deregister a symbol** | ||
- | |||
- | * Request Type: DeregisterSymbol | ||
- | * Parameters: | ||
- | * * symbol | ||
- | * * feedType[Lv1, | ||
- | |||
- | **4.03 Get Lv1 for a symbol** | ||
- | |||
- | * Request Type: GetLv1 | ||
- | * Parameters: | ||
- | * * symbol | ||
- | * * lv1side[Lv1Bid, | ||
- | |||
- | **4.04 Get Tos for a symbol** | ||
- | |||
- | * Request Type: GetTos | ||
- | * Parameters: symbol. | ||
- | * Returns: XML format | ||
- | | ||
- | '< | ||
- | | ||
- | |||
- | **4.05 Execute Single Order** | ||
- | |||
- | * Request Type: ExecuteOrder | ||
- | * Parameters: | ||
- | * * symbol | ||
- | * * price | ||
- | * * ordername | ||
- | * * shares | ||
- | * Returns: RequestId | ||
- | |||
- | **4.06 Cancel Single Order** | ||
- | |||
- | * Request Type: CancelOrder | ||
- | * Parameters: ordernumber | ||
- | |||
- | **4.07 Get Order Number for requestId** | ||
- | |||
- | * Request Type: GetOrderNumber | ||
- | * Parameters: requestid | ||
- | * Returns: orderNumber | ||
- | |||
- | **4.08 Execute Basket Order** | ||
- | |||
- | * Request Type: ExecuteListOrder | ||
- | * Parameters: | ||
- | * * symbol | ||
- | * * orderlistname | ||
- | * * shares | ||
- | |||
- | **4.09 Flatten** | ||
- | |||
- | * Request Type: Flatten | ||
- | * Parameters: symbol | ||
- | * Comments: | ||
- | * * If symbol is empty all positions for the trader will be flatten | ||
- | * * If symbol contains a symbol, only that symbol will be flatten | ||
- | * * If symbol contains a list of symbols separated by commas all those symbols will be flatten | ||
- | |||
- | **4.10 Get Orders** | ||
- | |||
- | * Request Type: GetOpenOrders | ||
- | * Parameters: none | ||
- | * Returns: XML format | ||
- | { | ||
- | < | ||
- | <Order id="" | ||
- | <Order id="" | ||
- | (....) | ||
- | </ | ||
- | } | ||
- | * Unordered List ItemComments: | ||
- | * * ID = 0 --> Accepted | ||
- | * * ID = 1 --> Part Filled | ||
- | * * ID = 2 --> Filled | ||
- | * * ID = 4 --> Cancelled | ||
- | * * ID = 8 --> Rejected | ||
- | |||
- | =====5. API Formats===== | ||
- | |||
- | |||
- | The user simply inputs a valid format with the command and parameters that wants to track. | ||
- | **Url Format:** | ||
- | < | ||
- | |||
- | **5.1 Rules** | ||
- | |||
- | - Ordered List ItemThe Format of the link is created on first position the “localhost: | ||
- | - It’s necessary use the character “?” between the “RequestType” and the first “parameter=value” to separate both commands. | ||
- | - To pass by reference more of one parameter will need use the character “&” between one parameter and another. | ||
- | - The symbol name need to be typed in Uppercase only. | ||
- | - To type the value of the parameter is necessary keep the format of Uppercase and lowercase. | ||
- | - If the command will returns some information, | ||
- | - Please note trader must first name and configure the orders in keyboard setup and then open API portal in PPro8. Otherwise API port won’t be able to execute order/order list. The API portal must be turned off before the trader modify any order in the keyboard setup. Once the setup is saved, trader can turn on the API portal and all changes will take effect. | ||
- | |||
- | **5.2 Examples** | ||
- | |||
- | **5.2.01 Register a symbol** | ||
- | |||
- | Url: localhost: | ||
- | |||
- | **5.2.02 GetLv1 for symbol** | ||
- | |||
- | * Unordered List ItemUrl: localhost: | ||
- | |||
- | **5.2.03 GetTos for symbol** | ||
- | |||
- | * Url: localhost: | ||
- | |||
- | **5.2.04 Execute order** | ||
- | |||
- | * Unordered List ItemUrl: localhost: | ||
- | |||
- | **5.2.05 Cancel order** | ||
- | |||
- | * Unordered List ItemUrl: localhost: | ||
- | |||
- | **5.2.06 Get orderNumber for request Id** | ||
- | |||
- | * Unordered List ItemUrl: localhost: | ||
- | |||
- | **5.2.07 Execute Basket Order** | ||
- | |||
- | * Unordered List ItemUrl: localhost: | ||
- | |||
- | |||
- | **6.08 Flatten** | ||
- | * Url: localhost: | ||
- | * Url: localhost: | ||
- | * Url: localhost: | ||
- | |||
- | 5.08 GetOpenOrders | ||
- | |||
- | * Unordered List ItemUrl: localhost: | ||
- | |||
- | =====6. Implementations===== | ||
- | |||
- | **6.1 Excel Web Queries** | ||
- | |||
- | The first step is “register” the symbol that you will use to retrieve the data, using the following URL: localhost: | ||
- | |||
- | Once you have the URL that contains the XML format for the data you want to retrieve like the current example to “Get Level 1 Bid side” with the follow URL: | ||
- | | ||
- | |||
- | Then go to Excel to use the Web Queries function to download it and format it as a nice, clean table inside your spreadsheet. | ||
- | |||
- | {{ : | ||
- | |||
- | If you click the “Data” tab on the Excel ribbon bar, then click “From Web,” a new window appears where you can paste the URL address from the financial data website. | ||
- | |||
- | {{ : | ||
- | |||
- | Click the “Import” button in the New Web Query window and a table containing the current live data from the site appears in your spreadsheet in the cell range you select. | ||
- | |||
- | {{ : | ||
- | |||
- | You can then use your mouse to resize the table or even move it to another part of your worksheet. | ||
- | |||
- | {{ : | ||
- | |||
- | Additionally, | ||
- | |||
- | **Keeping the Data Fresh** | ||
- | |||
- | An Excel Web Query allows you to retrieve the latest real-time data and insert it in your spreadsheet. | ||
- | |||
- | However, Web Query does not refresh data in the table automatically. To refresh the data, you must click the “Refresh All” icon in the Connections sections of the Data tab. | ||
- | |||
- | {{ : | ||
- | |||
- | Of course, you can record a macro for that as well, so that you can simply use the hot key combination to refresh the real-time data any time you wish. | ||
- | |||
- | If you click the button control icon in the “Insert” section of the Developer tab, you can create control buttons you can place on your spreadsheet and use to run the macros quickly with a single mouse click. | ||
- | |||
- | Click one button to retrieve the data and create the table in your spreadsheet, | ||
- | |||
- | **6.2 C# Web Request** | ||
- | |||
- | Go to Microsoft Visual Studio to use the **WebRequest** function to download it and format it as a nice, clean fields inside your program. | ||
- | |||
- | Please create a new project based on the following parts: | ||
- | |||
- | * Create a New Form | ||
- | * Add 2 textbox with the follow names: Symbol, Price | ||
- | * Add 4 buttons with the follow names: Register Symbol, Priview XML file, From XML to TextBox, Clear. | ||
- | * Add a RichTextBox with the name: XML Preview. | ||
- | |||
- | **Example: | ||
- | |||
- | {{ : | ||
- | |||
- | After create all the User Interface, we need to create the code for the following steps: | ||
- | |||
- | * Step #1: Type the symbol on the Symbol field what we want to request information. | ||
- | |||
- | * Step #2: “Register” the symbol that you will use to retrieve the data, using the following URL: localhost: | ||
- | |||
- | * Step #3: Preview the data you want to retrieve like the current example to “Get Level 1 Bid side” with the follow URL: localhost: | ||
- | |||
- | * Step #4: Convert XML data to the Price field to be able to manage the information from the server. | ||
- | |||
- | **Here will found the code example for each button used on the Form:** | ||
- | |||
- | **Register Symbol** | ||
- | |||
- | {{ : | ||
- | |||
- | Preview XML | ||
- | |||
- | {{ : | ||
- | |||
- | **From XML to Textbox** | ||
- | |||
- | {{ : | ||
- | |||
- | **The Libraries necessary are** | ||
- | |||
- | {{ : | ||
- | |||
- | **Declare the following variables on the “public partial class Form1 : Form”** | ||
- | |||
- | {{ : | ||
- | |||
- | **The Result of the example** | ||
- | |||
- | {{ : |
pproapi.1371849614.txt.gz · Last modified: 2017/03/14 12:35 (external edit)