How to Connect Velocity 2.0 to Python, C# & COM

Velocity 2.0 can now help you get your data into Python , C# & programming languages which can use COM libraries. This happens while Velocity continues to connect to the usual suspects which is Amibroker, MS Excel, Metastock, NinjaTrader 7 & 8, Multicharts etc...

Python Users:-

  1. Sample code has been provided for Python 3.x
  2. Please run the Sample COM app as admin and check to see the data flow before you start using the code.
  3. Please ensure comtypes version 1.1.3 is installed. Anaconda also comes with 1.1.2 as default.
  4. Please use 32 bit versions of Anaconda and or the modules you use. 
  5. Run Python ( via Pycharm / Ananconda) as Admin as Windows will block communication with another app (Velocity 2.0) if the app does not have admin rights.
  6. For Python support, please make sure you have PyCharm & Python 3.x installed. (all 32 Bit)
  7. Simply upgrading comtypes using "pip install --upgrade comtypes" has been seen to cause errors in some cases. If comtypes version 1.1.3 is not installed correctly, you will get this >> "AttributeError: 'module' object has no attribute 'ITrueData External' ". In that case, follow the steps as below:-
    • Uninstall the existing comtypes from the anaconda command prompt >> "pip uninstall comtypes"
    • Delete the entire comtypes library folder as remnants are causing issues after the upgrade. You can find the folder somewhere here >> "C:\........\Anaconda\Lib\site-packages\comtypes"
    • Install comtypes 1.1.3 using the command >> "pip install comtypes"
    • There should be no error returned after the installation.

C#.net Users

  1. Sample Code has been provided for C# .NET
  2. A sample application has also been provided to check and ensure the data flow. Please run the Sample app as admin and check to see the data flow before you start using the code.
  3. The sample project must be x86 and not x64 and the development environment must have full admin rights. Default sets up as 'Any', which will not work.

Please follow the following steps to connect:-

  1. Make sure you have the version 4.0.0.1116 of Velocity 2.0 or above. To check this, in Velocity 2,0, go to About. If not, then upgrade Velocity 2.0. Follow the steps as given here >> Easy Updating @ TrueData Velocity 2.0
  2. Make sure the TrueData.Velocity2.exe is given full admin rights & permissions from your firewall & antivirus. If you don't give Admin rights, you will get an Error#740 which means you need to give full admin rights. Follow the subsequent steps only after this is done.
  3. Download and install TrueData.Velocity.External.Setup.x86 from >> Here . This installation must be given full admin rights, before you start the installation, as it needs to register the dll files. 
  4. Download and install TrueData.Velocity.External.Setup.x64 from >> Here . This installation must be given full admin rights, before you start the installation, as it needs to register the dll files.  
  5. Download and Install Microsoft .Net framework 4, if not installed on your PC. get it from >> Here
  6. Please email us / live chat your details along with Login id (if you already have one) and we will then activate TrueData.External from our back-end. We provide a 3 day trial for the same. Both Velocity 2.0 & the External client API, need activation. Without specific activation at the back end, the data will not flow into the TrueData External Client API even if Velocity is activated.
  7. To check if you are set up correctly, run the sample application as Administrator. You can find the files on your PC at >> C:\........\TrueData\TrueData Client API x86\Release. Run the TrueData.Velocity.External.Sample.exe as admin to check the sample for C# set up and run the TrueData.Velocity.External.Sample.COM.exe as admin to check for Python & other COM set ups. 
  8. Click Initialize, followed by Start RT.. If you see the data flowing, you have set up correctly. Stop this application and you can start using the code provided now for Python 3.x, Com or C#. Please make sure you update the path of the tlb file in the code.(Python, Com)
  9. In some cases, the dll / tlb files may not get registered and may need to be registered manually. This step, however, is not required and must be used only as a last resort.
    >>regasm "C:\Program Files (x86)\TrueData\TrueData Client API x86\Binary COM\TrueData.Velocity.External.dll" /tlb:TrueData.Velocity.External.tlb /codebase
  10. Please contact our support for any more help.

Please note that this is only for personal use and limited to your subscription. If you are a software developer and have an application which you would like to connect to Velocity using the External, please contact our support. Please note that the discretion to terminate your subscription lies with TrueData.

Is article helpful?