Hi,
Is it possible to request open position status, via C2 Signal Entry API, before executing an API signal entry command?
Thanks
Currently, you can only request aggregate buying power. The Trade Entry API does not have a command to query account positions or recent executions.
However, that’s probably a good idea. So I’ll try to add it shortly.
Keep in mind that, in the meantime, you can always use the AutoTrade API (C2ATI) for stuff like this. It is, however, a step up in complexity. So having a lightweight API call in the Trade Entry API might be a good idea.
MK
How much does the C2ATI cost?
A nice round number. $0.
Brill! From where can I download it.
MK: If possible, I’d like a copy of the C2ATI.
Please email me. You have a half-dozen email accounts in my records, but all emails bounce. I need at least one valid email address in order to contact you.
Hi,
Does anyone have a VB code snippet which places a trade via the C2 Signal Entry API? If you do then I’d be grateful if you would share it.
Thanks
Private Sub Form_Load()
’ Set a reference to the internet transfer control.
Set objInet = Me!axInetTran.Object
End Sub
Private Sub cmdWriteFile_Click()
Dim b() as Byte
’ Set the internet transfer control protocol and URL.
objInet.Protocol = icHTTP
objInet.URL = “HTTP://www.microsoft.com”
’ Retrieve the HTML data into a byte array.
b() = objInet.OpenURL(objInet.URL,icByteArray)
’ Create a local file from the retrieved data.
Open “C:Homepage.htm” For Binary Access Write As #1
Put #1, , b()
Close #1
MsgBox “Done”
End Sub
Private Sub cmdGetHeader_Click()
’ Set the internet transfer control protocol and URL.
objInet.Protocol = icHTTP
objInet.URL = “HTTP://www.microsoft.com”
’ Open the HTML and display the header information.
objInet.openURL objInet.URL, icByteArray
MsgBox objInet.GetHeader
End Sub
Hi,
Does anyone have a VB code snippet which places a trade via the C2 Signal Entry API? If you do then I’d be grateful if you would share it.
Thanks
Select Project References. In the References dialog box click the Browse button. Navigate to C:WINDOWSMicrosoft.NETFrameworkv1.1.4322. Select the appropriate .tlb file and click Open. Click OK.
How do you know which assembly to select in Step 4? You need to look up the class of interest in the .Net class library documentation. In the Requirements section, it lists the assembly that contains the class. For example, the SortedList class is in Mscorlib, which means you would select Mscorlib.tlb in step 4 above.
You also have to register the assembly as a COM object. Unlike standard DLLs, which are registered with the REGSVR32 command line application, your must use the REGASM application that is installed with the .Net runtime. Here’s how:
Select Run from the Windows Start menu Enter cmd in the box and press Enter. Windows opens a command prompt. Change to the folder C:WINDOWSMicrosoft.NETFrameworkv1.1.4322. Type “regasm system.dll” and press Enter.
After doing this, you will be able to use some .Net classes as if they were COM objects. You must include the namespace qualifiers when declaring them, because VB6 does not give you the capability to import namespaces.
To illustrate, let’s use the WebClient class from .Net. This handy class provides the capability to download from and upload to a resource identified by a URL. By using the WebClient class in your program, you avoid the various problems that are known to plague the Internet Transfer control (the usual way to accomplish this in VB6).
The DownloadFile method in WebClient easily downloads data from a URL and saves it in a local file. This class is in the System assembly, so follow the steps above to add System.tlb to your project references. Be sure to use REGASM to register the assembly as well; you need do this only once.
Here’s some code that shows how to use this class in VB6 to download an image file and then display it in an Image control:
Dim wc As System.WebClient
Set wc = New System.WebClient
wc.downloadFile “http://www.somewhere.com/somefile.jpg”, _
App.Path & "filename.jpg"
Set Image1.Picture = LoadPicture(App.Path &
“filename.jpg”)When you run the code, the specified image displays in the Image control. Yes, it’s really that simple!
wonder do you have more sample codes for C+++ ? I need to see more sample and able to write my own application for api.
Thanks
Hello Mark,
Will you make the program (C2ATI) available for everyone to download from the Collecitve 2 web site? How about a seperate forum exculsively for programming only, anything else can be post on the regular forum.
Yes Matthew where can I download a sample API of the Order Entry in Basic?
thanks
Eric
There are C# samples at my site…you could convert them into VB.net