PC-SPAN (Page 2) - Options on Futures | futures.io
futures.io futures trading
 

Go Back   futures.io

> Futures Trading, News, Charts and Platforms > Traders Hideout > Options on Futures


PC-SPAN
Started:October 23rd, 2013 (09:36 AM) by ron99 Views / Replies:41,376 / 403
Last Reply:November 19th, 2016 (08:49 AM) Attachments:100

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike
     

Reply
 100  
 
Thread Tools Search this Thread

PC-SPAN

Old November 3rd, 2013, 06:25 PM   #11 (permalink)
Elite Member
Steubenville Ohio
 
Futures Experience: Intermediate
Platform: OX, OEC, RJO
Favorite Futures: Options on Futures
 
Posts: 179 since Sep 2012
Thanks: 24 given, 198 received


datahogg View Post
I have my copy of the PC Span, and it seems to work.

"Here is where you acquire the daily array files.
ftp://ftp.cmegroup.com/pub/span/data/"


Can some one direct me to the file name for the ES Span values(as an example) as a point to get started?

Thanks HH.

To get the risk arrays for ES options, click the CME link (ftp://ftp.cmegroup.com/pub/span/data/cme/).

Scroll down to the date you want to download ... name should look like this: cme.20131101.s.pa2.zip.

You'll notice other files with the same date but with different letters after the date. You should just need the 's' file for the settlement risk arrays. If you want a better understanding of the different arrays you can load look at this pdf from CME: http://www.cmegroup.com/clearing/files/Loading_a_Risk_Array_File.pdf.

Hope this helps.

Reply With Quote
     
The following 2 users say Thank You to Dudetooth for this post:
     

Old November 4th, 2013, 08:24 PM   #12 (permalink)
Elite Member
Steubenville Ohio
 
Futures Experience: Intermediate
Platform: OX, OEC, RJO
Favorite Futures: Options on Futures
 
Posts: 179 since Sep 2012
Thanks: 24 given, 198 received

Command Line Utilities

For anyone who may be interested, I have found a few more useful command-line utilities to use with PC-SPAN.

SpanPosConv.exe allows you to convert a CSV file with your portfolio to a XML file that PC-SPAN can import (PC-SPAN imports your positions from either POS or XML files). It can be downloaded from the CME Clearing House site CME Clearing House (you will have to log in with the info they gave you when you purchased PC-SPAN).

It comes with a sample CSV file to show you the format that your CSV file should be in, but they don't have much for instructions. A batch file to run this would look like this:

c:\Span4\SpanPosConv\SpanPosConv /i c:\Span4\SpanPosConv\RJO.csv /o c:\Span4\Data\RJO.xml /t np

The first path is where I unzipped the SpanPosConv utility; the path after "/i" is the input file; the path after "/o" the output file.


The RiskReporter.exe utility can create several useful CSV files that give you more detailed information about your positions and there is no need to download, it's already installed with PC-SPAN. All that is required is that you create a Risk.XML file (can be created by the spanit.exe utility as described at the end of post #6).

A batch file would look like this:

C:\Span4\Bin\RiskReporter.exe C:\Span4\Data\Risk_RJO.xml /PbReq_CSV /Pos_CSV /ScanRiskContr_CSV C:\Span4\Data\MySpanCalc.log

Path to RiskReporter.exe; Path of my Risk file; Reports I want; Path of MySpanCalc.log (not sure what it is, but you need this)

These are three of the more useful reports:
/PbReq_CSV - 'PB Requirements' report that has your portfolio margin requirements
/ScanRiskContr_CSV - 'Scan Risk Contributions' report that has the net positions, current value and margin requirements per position
/Pos_CSV - 'Positions' report that has your net positions, their current price and value

Hope this makes sense.

Reply With Quote
     
The following user says Thank You to Dudetooth for this post:
     

Old November 12th, 2013, 11:58 PM   #13 (permalink)
Market Wizard
OH
 
Futures Experience: Advanced
Platform: QST
Broker/Data: QST, DeCarley Trading, Gain
Favorite Futures: Options on Futures
 
Posts: 2,323 since Jul 2011
Thanks: 634 given, 3,899 received
Forum Reputation: Legendary



Dudetooth View Post
This is my first take at some VBA in a spreadsheet to help automate some of the tasks ... it's not pretty, but does some of the basic functions I was looking for (download risk arrays, unzip, rename, run batch file). It would be easy to tweak to have it open the Summary.csv and edit, etc. if you are comfortable with VBA. If not, let me know and I'll see what I can modify to have it do what you are looking for.

Thank you very much for this.

One thing is that I have to set the batch file location every time I use it. Where would I put the path in VBA? Attached is the VBA.

Attached Thumbnails
PC-SPAN-vba.jpg  
Reply With Quote
     

Old November 13th, 2013, 12:10 AM   #14 (permalink)
Market Wizard
OH
 
Futures Experience: Advanced
Platform: QST
Broker/Data: QST, DeCarley Trading, Gain
Favorite Futures: Options on Futures
 
Posts: 2,323 since Jul 2011
Thanks: 634 given, 3,899 received
Forum Reputation: Legendary

I was able to get SpanPosConv.exe to work. Here is how the spreadsheet would look for CL options. I put my symbol format for the firm. You can put whatever you want there.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
     
The following user says Thank You to ron99 for this post:
     

Old November 13th, 2013, 07:42 AM   #15 (permalink)
Elite Member
Steubenville Ohio
 
Futures Experience: Intermediate
Platform: OX, OEC, RJO
Favorite Futures: Options on Futures
 
Posts: 179 since Sep 2012
Thanks: 24 given, 198 received

Futures Edge on FIO

ron99 View Post
Thank you very much for this.

One thing is that I have to set the batch file location every time I use it. Where would I put the path in VBA? Attached is the VBA.

Initially I had this set up so that when you run the Set_Batch sub it would allow you to set the path/name for the batch file and save the value in cell B2. Then when running the download_risk_files sub it would look to cell B2 for the path/name value.

If you want your path/name to be set in VBA in the download_risk_files sub, just change the following line:

batchfile = Range("Sheet1!B2").Value

to read

batchfile = "C:\Span4\SPAN RiskRep RJO.bat" (just insert the path and name of your batch)

By the way, thanks ... I took your idea of keeping the risk array file name the same so I wouldn't have to change my spanit script. That made it easier for me to have my main spreadsheet do everything from downloading the risk arrays, unzipping them, renaming them, load my positions, create the risk reports and import key data into my spreadsheet. The only piece that I haven't yet come up is the code to create the position CSV file ... on the to-do list. I really like being able to do all of this through the spreadsheet rather than the PC-SPAN program, just easier for me I guess.


Last edited by Dudetooth; November 13th, 2013 at 07:58 AM. Reason: Added text
Reply With Quote
     
The following user says Thank You to Dudetooth for this post:
     

Old November 13th, 2013, 02:05 PM   #16 (permalink)
Market Wizard
OH
 
Futures Experience: Advanced
Platform: QST
Broker/Data: QST, DeCarley Trading, Gain
Favorite Futures: Options on Futures
 
Posts: 2,323 since Jul 2011
Thanks: 634 given, 3,899 received
Forum Reputation: Legendary

I run the Set_Batch sub and it works but the next day when I run the download_risk_files sub it doesn't work unless I run the Set_Batch sub again before I run the download_risk_files sub.

The path wasn't being kept in cell B2.

Putting the path in the sub worked. Thanks.

Instead of putting the path in the sub would it have also worked to just enter the path in cell B2?

Also I find I have to delete the cme.s.pa2 & nyb.s.pa2 files from the previous day for it to work. Should I have to be doing that? Any way to have the sub do that?

I greatly appreciate all of your help. I find that I am saving 3 minutes a day using the sub. 3 minutes times the 260 times a year I run it is 13 hours a year. I have used SPAN for 8 years so that is 104 hours or 4.3 days I won't be wasting in the next 8 years!

Reply With Quote
     

Old November 13th, 2013, 03:48 PM   #17 (permalink)
Elite Member
Steubenville Ohio
 
Futures Experience: Intermediate
Platform: OX, OEC, RJO
Favorite Futures: Options on Futures
 
Posts: 179 since Sep 2012
Thanks: 24 given, 198 received

As long as the spreadsheet was saved after running the Set_Batch sub, the path should have been retained in B2 (it was kind of hidden behind the button). Alternatively, you could simply type the path/name of batch file in B2 and save it and that would work just as well as the VBA.

I revamped my download_risk_files sub a bit and it takes care if the issue of having to delete the risk arrays. The following sub will just do the download risk arrays, unzip, delete old risk arrays, and then rename risk arrays:

Sub download_risk_files()
On Error GoTo GetOut
Dim RetVal
Dim batchfile As String
Dim path As String
dateit = Range("Risk!C1").Value 'Date in YYYYMMDD format
namecme = "cme." & dateit & ".s.pa2.zip"
namenyb = "nyb." & dateit & ".s.pa2.zip"
path = "C:\Span4\Data"

SaveWebFile "ftp://ftp.cmegroup.com/pub/span/data/cme/" & namecme, path & "\" & namecme
SaveWebFile "ftp://ftp.cmegroup.com/pub/span/data/nyb/" & namenyb, path & "\" & namenyb

Call UnZip(path & "\", path & "\" & namecme)
Call UnZip(path & "\", path & "\" & namenyb)

Kill path & "\cme.s.pa2"
Kill path & "\nyb.s.pa2"
Name path & "\" & "cme." & dateit & ".s.pa2" As path & "\cme.s.pa2"
Name path & "\" & "nyb." & dateit & ".s.pa2" As path & "\nyb.s.pa2"

GetOut:
End Sub


The "Kill" lines do the dirty work there. Then I use seperate subs for runnning my batch files and assign buttons to each one:

Sub RunPosRJO()
batchfile = "C:\Span4\SpanPosConv\SpanPosConvRJO.bat"
RetVal = Shell(batchfile, 1)
End Sub

Sub RunRiskRJO()
batchfile = "C:\Span4\SPAN Risk RJO.bat"
RetVal = Shell(batchfile, 1)
End Sub

Sub RunReportsRJO()
batchfile = "C:\Span4\SPAN RiskRep RJO.bat"
RetVal = Shell(batchfile, 1)
End Sub


I could probably run all of my batches in the same sub, but I usually keep them seperate when developing and testing the VBA ... perhaps I will combine them down the road.

Have you been using the RiskReporter.exe at all? If you do and are looking for a way to get data from the CSV files that it creates into another spreadsheet I can pass along my VBA to point you in the right direction.

It's no problem at all. I love finding ways to get VBA to do the dirty work, and it's the least I could do with all of the great info I get from you on the Selling Options thread.

Reply With Quote
     
The following 2 users say Thank You to Dudetooth for this post:
     

Old November 13th, 2013, 04:54 PM   #18 (permalink)
Market Wizard
OH
 
Futures Experience: Advanced
Platform: QST
Broker/Data: QST, DeCarley Trading, Gain
Favorite Futures: Options on Futures
 
Posts: 2,323 since Jul 2011
Thanks: 634 given, 3,899 received
Forum Reputation: Legendary

I added these two lines

Kill path & "\" & namecme
Kill path & "\" & namenyb


right underneath the Call UnZip lines to delete the unzipped files.

I also added my sub to format the csv file for use by Access and Excel (I need column B text to columns). But the sub doesn't wait until the batch is done before it runs my sub. I suspect I need a Do While line. How should that look?


Quoting 
Sub download_risk_files()
On Error GoTo GetOut
Dim RetVal
Dim batchfile As String
Dim path As String
dateit = Range("Sheet1!B3").Value
namecme = "cme." & dateit & ".s.pa2.zip"
namenyb = "nyb." & dateit & ".s.pa2.zip"
path = "C:\Span4\Data"

SaveWebFile "ftp://ftp.cmegroup.com/pub/span/data/cme/" & namecme, path & "\" & namecme
SaveWebFile "ftp://ftp.cmegroup.com/pub/span/data/nyb/" & namenyb, path & "\" & namenyb

Call UnZip(path & "\", path & "\" & namecme)
Call UnZip(path & "\", path & "\" & namenyb)

Kill path & "\" & namecme
Kill path & "\" & namenyb

Kill path & "\cme.s.pa2"
Kill path & "\nyb.s.pa2"
Name path & "\" & "cme." & dateit & ".s.pa2" As path & "\cme.s.pa2"
Name path & "\" & "nyb." & dateit & ".s.pa2" As path & "\nyb.s.pa2"

batchfile = "C:\Span4\Bin\SPAN-Batch.bat"
RetVal = Shell(batchfile, 1)

Call FormatSPANMargins
GetOut:
End Sub


Quoting 
Sub FormatSPANMargins()
Workbooks.Open Filename:="C:\Span4\Data\test.csv"
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1)), TrailingMinusNumbers:=True
Columns("A:A").EntireColumn.AutoFit
Range("B1").Select
ActiveWorkbook.SaveAs Filename:="C:\Span4\Data\SPANMargins.xls", FileFormat _
:=xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
End Sub


Reply With Quote
     

Old November 13th, 2013, 08:12 PM   #19 (permalink)
Elite Member
Steubenville Ohio
 
Futures Experience: Intermediate
Platform: OX, OEC, RJO
Favorite Futures: Options on Futures
 
Posts: 179 since Sep 2012
Thanks: 24 given, 198 received


ron99 View Post
I suspect I need a Do While line. How should that look?

Truthfully, I wasn't sure exactly how to do this. After looking around a bit it looks rather complex. Once the shell command is used to call the batch file that process is no longer under the control of VBA and that's why the code continues. Separate functions and subs are needed to tell VBA to pause.

I attached some code that I was going to try myself, but I won't be able to test until this weekend. It looks like it might be easy to copy-paste and modify his code.

The simple fix is to just not call your FormatSPANMargins sub from within the download_risk_files sub (delete the "Call FormatSPANMargins" line). Run download_risk_files, wait for the cmd window to close, and then run FormatSPANMargins.

I'll let you know if I get the VBA pause for batch files to work.

Attached Files
Register to download File Type: txt VBA Run Batch- wait until done before continue.txt (3.4 KB, 20 views)
Reply With Quote
     

Old November 13th, 2013, 10:53 PM   #20 (permalink)
Market Wizard
OH
 
Futures Experience: Advanced
Platform: QST
Broker/Data: QST, DeCarley Trading, Gain
Favorite Futures: Options on Futures
 
Posts: 2,323 since Jul 2011
Thanks: 634 given, 3,899 received
Forum Reputation: Legendary


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

Reply With Quote
     

Reply



futures.io > Futures Trading, News, Charts and Platforms > Traders Hideout > Options on Futures > PC-SPAN

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

NinjaTrader 8: Features and Enhancements, Tips and Tricks

Dec 6
 

Al Brooks: Stop Losing when a Good Trade goes Bad, Correcting Mistakes

Elite only
 

Trading Technologies: Algo Design Lab hands-on

Dec 13
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Current PC Specs tderrick Tech Support 45 October 28th, 2012 04:40 PM
Any PC Gamers in here? forrestang Off-Topic 61 October 10th, 2012 03:37 PM
Virtual PC setup how? boze man Tech Support 5 September 8th, 2012 04:59 PM
I need PC help Boomer34 Tech Support 5 January 22nd, 2012 03:28 PM
PC Question NMTrader Off-Topic 0 July 12th, 2009 11:56 PM


All times are GMT -4. The time now is 06:19 PM.

Copyright © 2016 by futures.io. 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.
 
no new posts

Page generated 2016-12-02 in 0.15 seconds with 20 queries on phoenix via your IP 23.23.54.109