Derivative Instruments and Hedging Activities Disclosure | Derivative Financial Instruments We selectively utilize crude oil and refined product commodity derivative contracts to reduce the risk associated with potential price changes on committed obligations as well as to reduce earnings volatility. We also utilize interest rate swaps to manage our exposure to interest rate risk. We do not speculate using derivative instruments. Credit risk on our derivative instruments is mitigated by transacting with counterparties meeting established collateral and credit criteria. Mark to Market We have certain contracts that serve as economic hedges, which are derivatives used for risk management but not designated as hedges for financial accounting purposes. All economic hedge transactions are recorded at fair value and any changes in fair value between periods are recognized in earnings. We have contracts that are used to fix prices on forecasted purchases of inventory, which we refer to as futures and forwards. Futures represent trades executed on the New York Mercantile Exchange which have not been closed or settled at the end of the reporting period. Forwards represent physical trades for which pricing and quantities have been set, but the physical product delivery has not occurred by the end of the reporting period. We also have economic hedges in the form of swap contracts that fix price differentials between different types of crude oil and refined products that we use or produce at our refineries. At September 30, 2016 , these swap contracts had aggregate volumes of 2,250 thousand barrels of crude oil with contract terms through December 2016. Fair Value Hedges Fair value hedges are used to hedge price volatility of certain refining inventories and firm commitments to purchase inventories. The gain or loss on a derivative instrument designated and qualifying as a fair value hedge, as well as the offsetting gain or loss on the hedged item attributable to the hedged risk, is recognized in earnings in the same period. We have certain commodity contracts associated with the Supply and Offtake Agreements discussed in Note 8 that have been accounted for as fair value hedges, which had purchase volumes of 466 thousand barrels of crude oil as of September 30, 2016 . Cash Flow Hedges To designate a derivative as a cash flow hedge, we document at the inception of the hedge the assessment that the derivative will be highly effective in offsetting expected changes in cash flows from the hedged item. This assessment, which is updated at least quarterly, is generally based on the most recent relevant historical correlation between the derivative and the hedged item. If, during the term of the derivative, the hedge is determined to be no longer highly effective, hedge accounting is prospectively discontinued and any remaining unrealized gains or losses, based on the effective portion of the derivative at that date, are reclassified to earnings when the underlying transactions occur. Commodity Derivatives. As of September 30, 2016 , we did not have any commodity swap contracts accounted for as cash flow hedges. During the first quarter of 2015, we elected to de-designate certain commodity swap contracts that were previously designated as cash flow hedges. Consequently, hedge accounting was discontinued for these commodity swap contracts and the related unrealized gains in other comprehensive income (“OCI”) were recorded into earnings as the underlying transactions occurred. During the three and nine months ended September 30, 2015 , we reclassified gains of $11,323 and $29,260 , respectively, from OCI into cost of sales related to these de-designated cash flow hedges. Related to commodity swap cash flow hedges in OCI, we recognized unrealized losses of $0 and $11,323 for the three months ended and $0 and $23,190 for the nine months ended September 30, 2016 and 2015 , respectively. Interest Rate Derivatives. We have interest rate swap agreements, maturing March 2019, that effectively fix the variable LIBOR interest component of the term loans within the retail credit agreement. These interest rate swaps have been accounted for as cash flow hedges. The aggregate notional amount under these agreements covers approximately 75% of the outstanding principal of these term loans throughout the duration of the interest rate swaps. As of September 30, 2016 , the outstanding principal of these term loans was $99,917 . The interest rate swaps lock in an average fixed interest rate of 1.69% through the remainder of 2016; 2.22% in 2017; 2.89% in 2018 and 3.06% in 2019. Related to interest rate swap cash flow hedges in OCI, we recognized unrealized gains (losses) of $554 and $(890) for the three months ended and $(669) and $(1,619) for the nine months ended September 30, 2016 and 2015 , respectively. For the three and nine months ended September 30, 2016 and 2015 , there was no cash flow hedge ineffectiveness recognized in income. No component of our cash flow hedges’ gains or losses was excluded from the assessment of hedge effectiveness. As of September 30, 2016 , we have unrealized losses of $2,845 classified in OCI related to cash flow hedges. Assuming interest rates remain unchanged, unrealized losses of $1,001 will be reclassified from OCI into earnings over the next twelve-month period as the underlying transactions occur. The following tables present the effect of derivative instruments on the consolidated balance sheets: As of September 30, 2016 Asset Derivatives Liability Derivatives Balance Sheet Location Fair Value Balance Sheet Location Fair Value Derivatives not designated as hedging instruments: Commodity contracts (futures and forwards) Accounts receivable $ 6,246 Accrued liabilities $ 6,370 Commodity contracts (swaps) Accounts receivable 3,767 — Total derivatives not designated as hedging instruments 10,013 6,370 Derivatives designated as hedging instruments: Interest rate swaps $ — Other non-current liabilities $ 2,845 Fair value hedges of consigned inventory Other assets 19,071 — Total derivatives designated as hedging instruments 19,071 2,845 Total derivatives $ 29,084 $ 9,215 As of December 31, 2015 Asset Derivatives Liability Derivatives Balance Sheet Location Fair Value Balance Sheet Location Fair Value Derivatives not designated as hedging instruments: Commodity contracts (futures and forwards) Accounts receivable $ 292 Accrued liabilities $ 884 Commodity contracts (swaps) Accounts receivable 14,799 — Total derivatives not designated as hedging instruments 15,091 884 Derivatives designated as hedging instruments: Interest rate swaps $ — Other non-current liabilities $ 2,176 Fair value hedges of consigned inventory Other assets 33,797 — Total derivatives designated as hedging instruments 33,797 2,176 Total derivatives $ 48,888 $ 3,060 The following tables present the effect of derivative instruments on the consolidated statements of operations and accumulated other comprehensive income: Derivatives designated as hedging instruments: Cash Flow Hedging Relationships Gain (Loss) Recognized in OCI Gain (Loss) Reclassified from Accumulated OCI into Income (Effective Portion) Gain (Loss) Reclassified from Accumulated OCI into Income (Ineffective Portion and Amount Excluded from Effectiveness Testing) Location Amount Location Amount For the Three Months Ended September 30, 2016 Interest rate swaps $ 554 Interest expense $ (237 ) $ — Total derivatives $ 554 $ (237 ) $ — For the Three Months Ended September 30, 2015 Commodity contracts (swaps) $ (11,323 ) Cost of sales $ 11,323 $ — Interest rate swaps (890 ) Interest expense (107 ) — Total derivatives $ (12,213 ) $ 11,216 $ — Cash Flow Hedging Relationships Gain (Loss) Recognized in OCI Gain (Loss) Reclassified from Accumulated OCI into Income (Effective Portion) Gain (Loss) Reclassified from Accumulated OCI into Income (Ineffective Portion and Amount Excluded from Effectiveness Testing) Location Amount Location Amount For the Nine Months Ended September 30, 2016 Interest rate swaps $ (669 ) Interest expense $ (535 ) $ — Total derivatives $ (669 ) $ (535 ) $ — For the Nine Months Ended September 30, 2015 Commodity contracts (swaps) $ (23,190 ) Cost of sales $ 29,260 $ — Interest rate swaps (1,619 ) Interest expense (219 ) — Total derivatives $ (24,809 ) $ 29,041 $ — Derivatives in fair value hedging relationships: Gain (Loss) Recognized in Income For the Three Months Ended For the Nine Months Ended September 30, September 30, Location 2016 2015 2016 2015 Fair value hedges of consigned inventory (1) Interest expense $ (2,385 ) $ 13,735 $ (14,726 ) $ 8,945 Total derivatives $ (2,385 ) $ 13,735 $ (14,726 ) $ 8,945 ________________ (1) Changes in the fair value hedges are substantially offset in earnings by changes in the hedged items. Derivatives not designated as hedging instruments: Gain (Loss) Recognized in Income For the Three Months Ended For the Nine Months Ended September 30, September 30, Location 2016 2015 2016 2015 Commodity contracts (futures and forwards) Cost of sales $ (1,286 ) $ (1,958 ) $ 5,134 $ (5,628 ) Commodity contracts (swaps) Cost of sales (66 ) 778 395 20,196 Total derivatives $ (1,352 ) $ (1,180 ) $ 5,529 $ 14,568 Offsetting Assets and Liabilities Our derivative instruments are subject to master netting arrangements to manage counterparty credit risk associated with derivatives, and we offset the fair value amounts recorded for derivative instruments to the extent possible under these agreements on our consolidated balance sheets. The following table presents offsetting information regarding our derivatives by type of transaction as of September 30, 2016 and December 31, 2015 : Gross Amounts of Recognized Assets/Liabilities Gross Amounts offset in the Statement of Financial Position Net Amounts Presented in the Statement of Financial Position Gross Amounts Not offset in the Statement of Financial Position Net Amount Financial Instruments Cash Collateral Pledged As of September 30, 2016 Derivative Assets: Commodity contracts (futures and forwards) $ 7,929 $ (1,683 ) $ 6,246 $ (6,246 ) $ — $ — Commodity contracts (swaps) 8,687 (4,920 ) 3,767 — — 3,767 Fair value hedges of consigned inventory 19,071 — 19,071 — — 19,071 Derivative Liabilities: Commodity contracts (futures and forwards) $ 8,053 $ (1,683 ) $ 6,370 $ (6,246 ) $ — $ 124 Commodity contracts (swaps) 4,920 (4,920 ) — — — — Interest rate swaps 2,845 — 2,845 — — 2,845 As of December 31, 2015 Derivative Assets: Commodity contracts (futures and forwards) $ 1,112 $ (820 ) $ 292 $ (292 ) $ — $ — Commodity contracts (swaps) 39,739 (24,940 ) 14,799 — — 14,799 Interest rate swaps 30 (30 ) — — — — Fair value hedges of consigned inventory 33,797 — 33,797 — — 33,797 Derivative Liabilities: Commodity contracts (futures and forwards) $ 1,704 $ (820 ) $ 884 $ (292 ) $ — $ 592 Commodity contracts (swaps) 24,940 (24,940 ) — — — — Interest rate swaps 2,206 (30 ) 2,176 — — 2,176 Compliance Program Market Risk We are obligated by government regulations to blend a certain percentage of biofuels into the products that we produce and are consumed in the U.S. We purchase biofuels from third parties and blend those biofuels into our products, and each gallon of biofuel purchased includes a renewable identification number, or RIN. To the degree we are unable to blend biofuels at the required percentage, a RINs deficit is generated and we must acquire that number of RINs by the annual reporting deadline in order to remain in compliance with applicable regulations. Alternatively, if we have a RINs surplus, some of those RINs could be sold. Any such sales would be subject to our normal credit evaluation process. We are exposed to market risk related to the volatility in the price of credits needed to comply with these governmental and regulatory programs. We manage this risk by purchasing RINs when prices are deemed favorable utilizing fixed price purchase contracts. We may also sell the RINs with an agreement to repurchase in the future. Some of these contracts are derivative instruments; however, we elect the normal purchase and sale exception and do not record these contracts at their fair values. The cost of meeting our obligations under these compliance programs (exclusive of benefit generated from our California renewable fuels project operations) was $12,863 and $6,558 for the three months ended and $33,210 and $29,648 for the nine months ended September 30, 2016 and 2015 , respectively. These amounts are reflected in cost of sales in the consolidated statements of operations. |