Questions

API Call To Facilitate Timely Data Transfer

+
0 Votes
Locked

API Call To Facilitate Timely Data Transfer

SDruley
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,
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

Clarifications

PurpleSkys Moderator

who is Susan? I'm not sure but maybe this should have been in a private message if it's sensitive. You should also consider removing your email address and phone number from your post. This is an open, public forum and scammers look for information like that.

robo_dev

A spreadsheet program running on a desktop PC is as far from a real-time computing application as you can get. It is by definition a single-threaded process. You cannot add train cars to a train whilst it is moving, and you cannot add data without pausing a process...and other than using a DOS batch file, updating Excel via a macro is the slowest train on the planet.