API Call To Facilitate Timely Data Transfer - TechRepublic
Question
November 14, 2012 at 03:12 PM
sdruley

API Call To Facilitate Timely Data Transfer

by sdruley . Updated 13 years, 7 months ago

Susan,
I guess I am taking a big risk in sending this code to you given your qualifications and unbelievable talent. But I respectfully submit to you a question that probably only you can answer. As part of a day trading program, I have two Workbooks, each in a separate instance of Excel, that need to pass data from the Bank workbook to the Picasso Workbook. The Bank Wkb is tied to the Chicago Merchantile Exchange. The Picasso Wkb is a state-of-the-art algorithmic platform that advises on whether BUYS or SELLS are in order. So what is the big deal? Well, I’m trying to get the stock data from Bank to Picasso without adding processor time to wait for the data to update. This added time causes late Trades which typically have no value to them. Perhaps there is some API routine available that contains such things as Sleep and DoEvents that can help me here. Please pay attention to the capitalized letters as a point of focus.

————————————————————–

‘xlQ from Qmatix must be loaded
‘dtn Interface active
Public Declare PtrSafe Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)
Public xlPicasso As Object
Public xlBank As Object
Public xlWBPicasso As Workbook
Public xlWBBank As Workbook
Public TransferFromBank As Range
Public TransferToPicasso As Range
——————————————————-
Sub Header()
Application.DisplayAlerts = False
Set xlPicasso = CreateObject(“Excel.Application”)
xlPicasso.Visible = True
Set xlWBPicasso = xlPicasso.Workbooks.Open(“C:\TTND\Picasso60.xlsm”)
Set xlWBBank = Application.Workbooks(“PicassoBank.xlsm”)
Set TransferFromBank = xlWBBank.Sheets(“intraday”).Range(“BANKB”)
Set TransferToPicasso = xlWBPicasso.Sheets(“INTRADAY”).Range(“BANKA”)
Port
End Sub
——————————————————-
Sub Port()

‘ SOME TYPE OF API CALL HERE TO ALLOW THE DATA TO BE UPDATED, CALCULATED AND PORTED WHILE THE CODE CONTINUES TO RUN.
‘ MY GOAL IS TO AVOID USING THE TakeBreak SUBROUTINE WHICH IS DESIGNED TO STOP THE CODE AND GET THE DATA COMING IN FROM STOCK QUOTES. IT SEEMS CRAZY THAT ONE WOULD HAVE TO STOP THE CODE TO PICK UP THE STOCK DATA. WHY CAN’T STOCK DATA UPDATE ITSELF WHILE CODE IS RUNNING?

TransferToPicasso.Value = TransferFromBank.Value ‘ Port data
‘TakeBreak
End Sub
——————————————————-
Sub TakeBreak()
T = xlWBPicasso.Application.Range(“cycleTIME”)
T = Application.WorksheetFunction.Min(T, 8)
T = Application.WorksheetFunction.Max(T – 2, 4)
T = Format(T, “00”)
T = “00:00:” & T
Application.OnTime Now + TimeValue(T), “Port”, Schedule = True
End Sub
_______________________________________________________
_______________________________________________________
Susan, I would be very happy to pay for your services here.

Respectfully,

Dr. Stephen Druley
staryman@att.net
828-292-2457

This discussion is locked

All Comments