-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
22,096 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
# Globalization | ||
This broker plug-in can be configured to support any language through the use of resource files. | ||
|
||
## Currently Supported Languages | ||
|
||
* English (United States) **en-US** | ||
* French (Standard) **fr** | ||
* German (Standard) **de** | ||
* Spanish (Spain) **es** | ||
|
||
**NOTE:** The French, German, and Spanish language resources are translated from English with Google Translate. They may not be the most accurate translations of the corresponding English language phrases. Native language speakers are encouraged to make changes to the appropriate language resource files, incorporate them into a new broker plugi-in for testing, and share them with the Zorro community. | ||
|
||
## Where to Specify a Language | ||
You inform this plug-in of the language to use by appending a language specification to the **consumer key** entered into the User ID field of the Zorro trading engine window. See the documentation for information on [appending a language specification](https://github.com/cwford/TDAmTrade_Zorro_Plugin#using-the-td-ameritrade-broker-plug-in) to a **consumer key**. You can also [change the default langugae specification](https://github.com/cwford/TDAmTrade_Zorro_Plugin#initializing-the-settings-file) in the Settings file. | ||
|
||
## Modifying and Adding Languages | ||
Globalization language support in this plug-in is achieved through the use of language-specific resource files. These resource files are located in the plug-in solution folder at ../Resources/xx-YY.resx, where xx is the two-letter language code and YY is the country or region code, if required. For example, **en-US** represents the English language as spoken in the United States, while **en-NZ** represents the English language as spoken in New Zealand. See [below](https://github.com/cwford/TDAmTrade_Zorro_Plugin/blob/master/Documentation/Languages.md#language-specifications) for a complete list of language specifications. | ||
|
||
**To modify an existing language resource file in Visual Studio:** | ||
1. Open the corresponding xx-YY.resx resource file. | ||
2. Make appropriate changes. | ||
3. Save and close the file. | ||
4. Re-build the solution. | ||
5. Copy the new DLL to the Zorro Plugin folder. | ||
|
||
**To add a new language, follow these steps:** | ||
1. Create a new resource file in the **Resources** folder of the plug-in solution. It should be named xx-YY, where xx is the two-letter language code, and YY is the region or country code, if needed. See [below](https://github.com/cwford/TDAmTrade_Zorro_Plugin/blob/master/Documentation/Languages.md#language-specifications) for a complete list of language specifications. | ||
2. Copy the left-hand column of the "en-US.resx" file to the left-hand column of this new language resource file. | ||
3. Add translations of the middle column of the "en-US.resx" file to the middle column of this new language resource file. | ||
4. Save and close the file | ||
5. Re-build the solution | ||
6. Copy the new DLL to the Zorro Plugin folder. | ||
|
||
## Language Specifications | ||
|
||
* Afrikaans **af** | ||
* Albanian **sq** | ||
* Arabic (Algeria) **ar-DZ** | ||
* Arabic (Bahrain) **ar-BH** | ||
* Arabic (Egypt) **ar-EG** | ||
* Arabic (Iraq) **ar-IQ** | ||
* Arabic (Jordan) **ar-JO** | ||
* Arabic (Kuwait) **ar-KW** | ||
* Arabic (Lebanon) **ar-LB** | ||
* Arabic (Libya) **ar-LY** | ||
* Arabic (Morocco) **ar-MA** | ||
* Arabic (Oman) **ar-OM** | ||
* Arabic (Qatar) **ar-QA** | ||
* Arabic (Saudi Arabia) **ar-SA** | ||
* Arabic (Syria) **ar-SY** | ||
* Arabic (Tunisia) **ar-TN** | ||
* Arabic (U.A.E.) **ar-AE** | ||
* Arabic (Yemen) **ar-YE** | ||
* Basque **eu** | ||
* Belarusian **be** | ||
* Bulgarian **bg** | ||
* Catalan **ca** | ||
* Chinese (Hong Kong) **zh-HK** | ||
* Chinese (PRC) **zh-CN** | ||
* Chinese (Singapore) **zh-SG** | ||
* Chinese (Taiwan) **zh-TW** | ||
* Croatian **hr** | ||
* Czech **cs** | ||
* Danish **da** | ||
* Dutch (Belgium) **nl-BE** | ||
* Dutch (Standard) **nl** | ||
* English **en** | ||
* English (Australia) **en-AU** | ||
* English (Belize) **en-BZ** | ||
* English (Canada) **en-CA** | ||
* English (Ireland) **en-IE** | ||
* English (Jamaica) **en-JM** | ||
* English (New Zealand) **en-NZ** | ||
* English (South Africa) **en-ZA** | ||
* English (Trinidad) **en-TT** | ||
* English (United Kingdom) **en-GB** | ||
* English (United States) **en-US** | ||
* Estonian **et** | ||
* Faeroese **fo** | ||
* Farsi **fa** | ||
* Finnish **fi** | ||
* French (Belgium) **fr-BE** | ||
* French (Canada) **fr-CA** | ||
* French (Luxembourg) **fr-LU** | ||
* French (Standard) **fr** | ||
* French (Switzerland) **fr-CH** | ||
* Gaelic (Scotland) **gd** | ||
* German (Austria) **de-AT** | ||
* German (Liechtenstein) **de-LI** | ||
* German (Luxembourg) **de-LU** | ||
* German (Standard) **de** | ||
* German (Switzerland) **de-CH** | ||
* Greek **el** | ||
* Hebrew **he** | ||
* Hindi **hi** | ||
* Hungarian **hu** | ||
* Icelandic **is** | ||
* Indonesian **id** | ||
* Irish **ga** | ||
* Italian (Standard) **it** | ||
* Italian (Switzerland) **it-CH** | ||
* Japanese **ja** | ||
* Korean **ko** | ||
* Korean (Johab) **ko** | ||
* Kurdish **ku** | ||
* Latvian **lv** | ||
* Lithuanian **lt** | ||
* Macedonian (FYROM) **mk** | ||
* Malayalam **ml** | ||
* Malaysian **ms** | ||
* Maltese **mt** | ||
* Norwegian **no** | ||
* Norwegian (Bokmål) **nb** | ||
* Norwegian (Nynorsk) **nn** | ||
* Polish **pl** | ||
* Portuguese (Brazil) **pt-BR** | ||
* Portuguese (Portugal) **pt** | ||
* Punjabi **pa** | ||
* Rhaeto-Romanic **rm** | ||
* Romanian **ro** | ||
* Romanian (Republic of Moldova) **ro-MD** | ||
* Russian **ru** | ||
* Russian (Republic of Moldova) **ru-MD** | ||
* Serbian **sr** | ||
* Slovak **sk** | ||
* Slovenian **sl** | ||
* Sorbian **sb** | ||
* Spanish (Argentina) **es-AR** | ||
* Spanish (Bolivia) **es-BO** | ||
* Spanish (Chile) **es-CL** | ||
* Spanish (Colombia) **es-CO** | ||
* Spanish (Costa Rica) **es-CR** | ||
* Spanish (Dominican Republic) **es-DO** | ||
* Spanish (Ecuador) **es-EC** | ||
* Spanish (El Salvador) **es-SV** | ||
* Spanish (Guatemala) **es-GT** | ||
* Spanish (Honduras) **es-HN** | ||
* Spanish (Mexico) **es-MX** | ||
* Spanish (Nicaragua) **es-NI** | ||
* Spanish (Panama) **es-PA** | ||
* Spanish (Paraguay) **es-PY** | ||
* Spanish (Peru) **es-PE** | ||
* Spanish (Puerto Rico) **es-PR** | ||
* Spanish (Spain) **es** | ||
* Spanish (Uruguay) **es-UY** | ||
* Spanish (Venezuela) **es-VE** | ||
* Swedish **sv** | ||
* Swedish (Finland) **sv-FI** | ||
* Thai **th** | ||
* Tsonga **ts** | ||
* Tswana **tn** | ||
* Turkish **tr** | ||
* Ukrainian **uk** | ||
* Urdu **ur** | ||
* Venda **ve** | ||
* Vietnamese **vi** | ||
* Welsh **cy** | ||
* Xhosa **xh** | ||
* Yiddish **ji** | ||
* Zulu **zu**} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Details About the Plug-In | ||
|
||
## Architecture | ||
The plug-in is built around the architecture shown in the following diagram: | ||
|
||
|
||
<p align="center"> | ||
<img src="https://github.com/cwford/TDAmTrade_Zorro_Plugin/blob/master/Documentation/Images/Architecture.png"> | ||
</p> | ||
|
||
### How the Plug-In Works | ||
The Zorro trading engine expects to be able to call entry points in a 32-bit broker plug-in with standard C calling conventions. <em>DllExport</em>, the 3rd party library referenced below, allows for a C# program to create endpoints in a DLL which can be called with standard conventions code written in C++. Of course, the plug-in must be compiled for an x86 (32-bit) platform. | ||
|
||
Even given <em>DllExport</em>, there is also the question of how input and output parameters are passed to the broker plug-in methods called by the Zorro trading engine. Most input parameters to the broker plug-in methods are integer values which can be passed as int32 by the trading engine and received as int32 by the C# methods in the plug-in. But some of the input parameters, and all of the output parameters, are passed as C++ pointers. | ||
|
||
C++ pointers, particularly when they point to double values, are sometimes represented as an array of doubles in managed code (C#). The first element of the array is at the address pointed to by the pointer passed to the C# method, so assigning a value to the first element should, in theory, place it at the memory location allocated for it by the Zorro trading engine. | ||
|
||
The problem with using arrays of doubles, in lieu of pointers, is that it is difficult, if not impossible, to check for the validity of the addresses they point to. Occassionally, Zorro will pass a null pointer when the C# code is expecting a vaild address for the start of an array. Assigning a value to a null pointer results in a runtime error. | ||
|
||
So, instead of reperesenting output pointer variables, and some input pointer variables, as arrays of doubles, the plug-in represents these variables as **IntPtr**. Then, using an **unsafe** code block, the plug-in casts them to the correct pointer type and tests for them being null prior to assigning a value to the address they point to. Thus, the broker plug-in solution must be compiled with the **unsafe** checkbox checked. | ||
|
||
|
||
### Modifying the C# Code | ||
To modify this broker plug-in do the following: | ||
|
||
1. Clone the repository or download the zip file | ||
2. Open the solution in a recent version of Visual Studio. | ||
3. Make any required changes to the plug-in code. | ||
4. Double-check that you are building for an x86 (32-bit( platform. | ||
5. Double-check that the **unsafe** checkbox has been checked so the compiler will compile unmanaged code. | ||
6. Re-build the plug-in and eliminate any errors. | ||
7. Copy the plug-in to the Zorro plug-in folder. | ||
8. Test the plug-in's operation. | ||
|
||
### Dependencies | ||
#### DllExport | ||
The plug-in is dependent upon the 3rd party library, <em>DllExport</em>, which can be found on NuGet, or at: | ||
|
||
https://github.com/3F/DllExport/releases | ||
|
||
**NOTE:** There is another DllExport library by Robert Giesecke, entitled <em>UnmanagedExports</em> which has similar namespaces and similar methods. **DO NOT USE this DLL only use the DLL referenced above.** | ||
|
||
When installing <em>DllExport</em> a configuration screen will pop-up. You can simply press the **Apply** button to accept the default configuration of <em>DllExport</em>. | ||
|
||
#### Sqlite Dependencies | ||
The plug-in uses Sqlite as an embedded database, and Microsoft.Data.Sqlite should be installed as a NuGet package. | ||
|
||
**NOTE:** Only Microsoft.Data.Sqlite version 1.1.1 works and has been tested with this plug-in. Later versions will resolve all namespaces but produce runtime dependency errors. | ||
|
||
#### DLLs Copied to Zorro | ||
The Visual Studio solution for building the plug-in copies the following three files to the Zorro Plugin Folder: | ||
|
||
|**In Visual Studio Solution**|**Copied to Zorro Plugin Folder As**|**Description** | ||
|----------------------|--------------------------------|---------------------| | ||
|TDAmeritradeZorro.dll|TDAmeritrade.dll|Main broker plug-in| | ||
|Microsoft.Data.Sqlite (v 1.1.1)|Microsoft.Data.Sqlite|Microsoft Sqlite ADO.NET library| | ||
|sqlite3.dll|sqlite3.dll|Native Sqlite library| | ||
|DBLib.dll|DbLib.dll|Data access library for Sqlite| | ||
|
||
**NOTE:** These three files must be present in the Zorro plug-in folder for this plug-in to work. | ||
|
||
### Caution | ||
The developer found several instances where even commonly used methods from standard Windows .NET libraries did not interact well with the DllExport library. Again, no attempt was made to find solutions or workarounds to these issues. Instead, different means of accomplishing the same task were tried until one was found that worked. Other developers should be cautious in using Windows classes or methods they are familiar with in this plug-in. Extensive testing is necessary to confirm that any additions to this plug-in, which rely on classes not already used in this plug-in, actually work. Most often, the DLL containing these new classes must be copied to the Zorro plug-in folder. | ||
|
||
### Documentation | ||
The code for this plug-in is extensively documented with one exception. The JSON objects returned from the TD Ameritrade API are not well-documented because there is little documentation to be found about these objects and their many properties. They are, however, converted into .NET class objects by a JSON converter and the information the Zorro trading engine needs from them is then extracted. | ||
|
||
**If you plan on making modifications to the plug-in code, please consider retaining the look and feel of the current documentation so that anyone coming after you will have an easy time making modifications.** | ||
|
Oops, something went wrong.