I Was (Great American) Eclipsed

EclipseFor those of you who experienced the Great American Eclipse, enough said.  For those who missed it, let me be the first to commiserate with you; you quite simply have no idea.

I could say something like “The moment was glorific;” a true statement, for sure, although an inadequate testament at best.  Indeed, the worst traffic jam in Wyoming history could do nothing to lessen my appreciation and wonder.  I’d do it again in a heartbeat!

BTW, the traffic jam was truly epic.  In my own case, it took ten miserable hours for my wife and I to crawl back to Denver even though the outward journey only took about three.  And we were the lucky ones; three of the four other couples that accompanied us on this trip took at least 13½ exhausting hours to do the same.

To get a good sense of the how the eclipse went down (at least in Casper, WY), check out KCWY13’s Even Scientist Were Blown Away By Great American Eclipse.  I get a good bit of air-time and I only manage to make one flub; see if you can spot it.  As to my favorite moment, at 1:48 or so my friend friend Gary Trapuzzano and his lovely wife Tracey Berlin kiss on camera after totality, clearly elated if also a bit stunned; pretty much summing up the whole experience for me.  Sheer magic.

Again, the eclipse was transcendent.  Word to the wise, though: 4/8/2024 looks to be even better!

Tickety, Tickety Tick

TickerTo develop and back-test trading algos its essential to have great gobs of historical data on hand, almost always at the tick level.  More often than not this data comes from your broker—OANDAAlpariDukasCopy, and Integral (TrueFX), to name a popular few—whether through commercial platforms like MT4 or proprietary APIs.  Alternately, one can use a generic downloader like Birt’s Tick Data Suite.

Over the years I’ve worked with more than a dozen brokers and other data providers so you think I’d have a handle on this stuff by now, but nothing could be further from the truth.  No, its an ever changing and messy landscape.   Continue reading

Cancel That

Cancellation in a multi-threaded Console App can be surprisingly difficult, even though I’ve done it dozens (hundreds?!?) of times before.  As any programmer can tell you, there are the “Things you know” and “Things you merely think you know.”  In programming, fiddly little details count.

I won’t go into the trade-offs between using Tasks or Parallel.For[Each] or TPL DataFlow, but suffice it to say that the later is both the most useful and easiest to get right.  Enjoy…

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;

namespace CancelDemo
   class Program
      static void Main(string[] args)
         Console.WriteLine("Press any key to cancel...");

         var cts = new CancellationTokenSource();

         var client = new HttpClient();

            var fetcher = new ActionBlock<string>(
               async url =>
                  await client.GetAsync(url, cts.Token);

                  Console.WriteLine($"FETCHED {url}");
               new ExecutionDataflowBlockOptions()
                  CancellationToken = cts.Token,
                  MaxDegreeOfParallelism = Environment.ProcessorCount

            urls.ForEach(url => fetcher.Post(url));


            var readKey = new TaskFactory(cts.Token).StartNew(() =>
               while (!Console.KeyAvailable)



            Task.WaitAny(new Task[] { fetcher.Completion, readKey });
         catch (OperationCanceledException)
         catch (Exception error)

            Console.WriteLine("Error: " + error.Message);

         Console.Write("Press any key to terminate...");


      private static List<string> urls = new List<string>()