NexusFi: Find Your Edge


Home Menu

 





PC-SPAN


Discussion in Options

Updated
      Top Posters
    1. looks_one Dudetooth with 218 posts (213 thanks)
    2. looks_two ron99 with 116 posts (55 thanks)
    3. looks_3 CafeGrande with 30 posts (4 thanks)
    4. looks_4 BlueRoo with 24 posts (5 thanks)
      Best Posters
    1. looks_one Dudetooth with 1 thanks per post
    2. looks_two SMCJB with 1 thanks per post
    3. looks_3 ron99 with 0.5 thanks per post
    4. looks_4 BlueRoo with 0.2 thanks per post
    1. trending_up 188,781 views
    2. thumb_up 317 thanks given
    3. group 75 followers
    1. forum 610 posts
    2. attach_file 159 attachments




 
Search this Thread

PC-SPAN

  #21 (permalink)
 ron99 
Cleveland, OH
 
Experience: Advanced
Platform: QST
Broker: QST, DeCarley Trading, Gain
Trading: Options on Futures
Posts: 3,081 since Jul 2011
Thanks Given: 980
Thanks Received: 5,785

I hate to bother you but my sub does everything down to doing the batchfile and for one second the DOS window flashes on my screen but it doesn't run.

But if I click on the batch file in Windows Explorer it works OK. So it's not the batchfile.

I tried running the batchfile as a separate sub and it still doesn't run. It just flashes for one second.

Sub RunSPANBatchfile()
batchfile = "C:\Span4\Bin\SPANBatch.bat"
RetVal = Shell(batchfile, 1)
End Sub


I am using Excel 2010 with VBA 7.0.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
38 thanks
NexusFi site changelog and issues/problem reporting
27 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #22 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


ron99 View Post
But if I click on the batch file in Windows Explorer it works OK. So it's not the batchfile.

I tried running the batchfile as a separate sub and it still doesn't run. It just flashes for one second.

I had a similar problem with one of my batch files. I think it is related to the path (I can't find any definitive proof). Most of my batch files were located in the C:\Span4 folder, but I had 2 in the sub-folder C:\Span4\SpanPosConv. The name of the Batch had a space in it and it just flashed the cmd window when I tried to run it in VBA as "C:\Span4\SpanPosConv\SpanPosConv RJO.bat". My other batch files in the C:\Span4 folder had spaces in their name and worked fine when called through VBA.

I removed the space in the name of the batch and was able to call it as "C:\Span4\SpanPosConv\SpanPosConvRJO.bat". I also tried moving the batch to the C:\Span4 folder and leaving the name with the space and that also worked calling "C:\Span4\SpanPosConv RJO.bat".

You mentioned that your batch works fine when you click on it, so it should not be an error in the batch. The name of your batch does not have a space, but it is in a sub folder. I have no idea why it would have issues with the path, but I would recommend moving the batch to the C:\Span4 folder and modify your sub:

Sub RunSPANBatchfile()
Dim RetVal
Dim batchfile as string
batchfile = "C:\Span4\SPANBatch.bat"
RetVal = Shell(batchfile, 1)
End Sub


Hopefully this will take care of the issue.

Reply With Quote
Thanked by:
  #23 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274



ron99 View Post
I'll just not call my format sub. Not that big of a deal.

I was able to get this to work by editing only a few lines of that text that was in the file I upload. Now I can run one sub that can call multiple batch files, wait for each to complete before running the next, and then run additional code. I can walk you through that if you are interested.

Reply With Quote
  #24 (permalink)
 ron99 
Cleveland, OH
 
Experience: Advanced
Platform: QST
Broker: QST, DeCarley Trading, Gain
Trading: Options on Futures
Posts: 3,081 since Jul 2011
Thanks Given: 980
Thanks Received: 5,785


Dudetooth View Post
I had a similar problem with one of my batch files. I think it is related to the path (I can't find any definitive proof). Most of my batch files were located in the C:\Span4 folder, but I had 2 in the sub-folder C:\Span4\SpanPosConv. The name of the Batch had a space in it and it just flashed the cmd window when I tried to run it in VBA as "C:\Span4\SpanPosConv\SpanPosConv RJO.bat". My other batch files in the C:\Span4 folder had spaces in their name and worked fine when called through VBA.

I removed the space in the name of the batch and was able to call it as "C:\Span4\SpanPosConv\SpanPosConvRJO.bat". I also tried moving the batch to the C:\Span4 folder and leaving the name with the space and that also worked calling "C:\Span4\SpanPosConv RJO.bat".

You mentioned that your batch works fine when you click on it, so it should not be an error in the batch. The name of your batch does not have a space, but it is in a sub folder. I have no idea why it would have issues with the path, but I would recommend moving the batch to the C:\Span4 folder and modify your sub:

Sub RunSPANBatchfile()
Dim RetVal
Dim batchfile as string
batchfile = "C:\Span4\SPANBatch.bat"
RetVal = Shell(batchfile, 1)
End Sub


Hopefully this will take care of the issue.

I moved the batchfile to SPAN4. And then copied and pasted your sub. I now get the error that SPANData.dll is not on my computer. I moved the SPANData.dll from the Bin folder to the SPAN4 folder and I still get the same error message.

I have used too much time on trying to get this to work. I need to move on. Your download risk files sub has been a big help thanks.

Started this thread Reply With Quote
  #25 (permalink)
 ron99 
Cleveland, OH
 
Experience: Advanced
Platform: QST
Broker: QST, DeCarley Trading, Gain
Trading: Options on Futures
Posts: 3,081 since Jul 2011
Thanks Given: 980
Thanks Received: 5,785


Dudetooth View Post
I was able to get this to work by editing only a few lines of that text that was in the file I upload. Now I can run one sub that can call multiple batch files, wait for each to complete before running the next, and then run additional code. I can walk you through that if you are interested.

I may be crazy to try but can you easily do that?

Started this thread Reply With Quote
  #26 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


ron99 View Post
I have used too much time on trying to get this to work. I need to move on.

I'm sorry that it didn't help. I know the dll file needs to be in the same folder as the spanit.exe. The error makes me think that there might be something in the batch file or span script that might be throwing it off (file name or path of batch that has changed). If you decide later to give it another go, I'll be happy to try to help you troubleshoot.

Reply With Quote
  #27 (permalink)
 Dudetooth 
Steubenville Ohio
 
Experience: Intermediate
Platform: OX, OEC, RJO
Trading: Options on Futures
Posts: 266 since Sep 2012
Thanks Given: 30
Thanks Received: 274


ron99 View Post
I may be crazy to try but can you easily do that?

It's pretty painless.
1- copy all the code from the text file uploaded and paste it above all of your other code in your module.
(all of the "Option Explicit", "Private Declare Function" and "Private Const" lines need to be on top, above all the subs ... if you have any other "Private Declare Functions" they'll have to be moved above the subs as well)

2- edit the "Sub Run_bat()" as needed. It is currently set to run 2 batch files and then call another sub "copy_data_RJO" in my spreadsheet ... just change the name/path of the batch files:
"C:\Span4\SPAN Risk RJO.bat" and "C:\Span4\SPAN RiskRep RJO.bat" and insert code to call other subs as needed.

Attached Files
Elite Membership required to download: Code.txt
Reply With Quote
  #28 (permalink)
 ron99 
Cleveland, OH
 
Experience: Advanced
Platform: QST
Broker: QST, DeCarley Trading, Gain
Trading: Options on Futures
Posts: 3,081 since Jul 2011
Thanks Given: 980
Thanks Received: 5,785


Dudetooth View Post
I'm sorry that it didn't help. I know the dll file needs to be in the same folder as the spanit.exe. The error makes me think that there might be something in the batch file or span script that might be throwing it off (file name or path of batch that has changed). If you decide later to give it another go, I'll be happy to try to help you troubleshoot.

I got it to work. I changed my SPANBatch from

spanit C:\Span4\Bin\SPANScript.txt

to

C:\Span4\Bin\spanit C:\Span4\Bin\SPANScript.txt

Looks like it needed the full path for spanit.

You mentioning the path made me think of this.

Started this thread Reply With Quote
  #29 (permalink)
 spj77 
Qld, Australia
 
Experience: Beginner
Platform: Excel/Hoadley/PC-SPAN
Broker: OX
Trading: Options
Posts: 28 since Mar 2012
Thanks Given: 6
Thanks Received: 44

Hi,

You guys will be fully fledged programmers soon!

Do you happen to know an easy way to get the margins on a list of OX symbols such as the following list out of SPAN:

ESZ31400P
ESF41300P
CLF4115C
CLF475P
CLG4120C
NGZ34.15C
NGZ33.25P
NGG45.5C
NGH45.7C
GCG41700C
KCH41600C
SF41060P
SH41600C
ECZ31.405C

I am thinking that simply listing them into a portfolio csv file and loading them up with SpanPosConv (net position of 1 each) and calculating the perf bond req will calculate the margins for each as part of a spread within the portfolio etc - But i am hoping to get just the straight margin for each as if it were traded independently of anything else, like if it was the only position in the portfolio....

Cheers
Scott

Reply With Quote
  #30 (permalink)
 ron99 
Cleveland, OH
 
Experience: Advanced
Platform: QST
Broker: QST, DeCarley Trading, Gain
Trading: Options on Futures
Posts: 3,081 since Jul 2011
Thanks Given: 980
Thanks Received: 5,785


Scott, if you put the symbol in the firm name then you will get the margin for each. That is what I do. See post #14.

SPAN will group the results by firm name with the same acct ID. So everything on the spreadsheet will the same firm name and acct ID will be calculated together to give you margin for all lines of the spreadsheet with that firm name and acct ID.

If you want margin for each contract then put your symbol in the firm name and anything in acct ID.

If you want margin for a spread, Put the same firm name and acct ID for each leg. SPAN will then combine them.

Tip: The spreadsheet must be closed in order to run the SPANPosConv batch. Also blank lines in spreadsheet are ignored.


This is how it would look if you put them into the SPAN program.

Started this thread Reply With Quote
Thanked by:




Last Updated on September 23, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts