Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions fecon236/futures/cftc.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# Python Module for import Date : 2018-06-17
# vim: set fileencoding=utf-8 ff=unix tw=78 ai syn=python : per PEP 0263
'''
_______________| cftc.py :: For futures markets under CFTC
"""Futures markets under CFTC

- CFTC:= Commodity Futures Trading Commission, a US government agency
- COTR:= Commitment of Traders Report
Definitions
-----------

CFTC
Commodity Futures Trading Commission, a US government agency
COTR
Commitment of Traders Report

References
----------

REFERENCE
- "Market position indicators using CFTC COTR", https://git.io/cotr
A fecon235 Jupyter notebook illustrating derivation and usage.

Notes
-----
For LATEST version, see https://git.io/fecon236

CHANGE LOG For LATEST version, see https://git.io/fecon236
2018-06-17 First version: groupcotr() spin-off from util.group module.
'''
Change Log
----------

* 2018-06-17 First version: `groupcotr` spin-off from util.group module.
"""

from __future__ import absolute_import, print_function, division

Expand All @@ -32,11 +43,12 @@


def groupcotr(group=cotr4w, alpha=0):
'''Compute latest normalized CFTC COTR position indicators.
COTR is the Commitment of Traders Report from US gov agency.
Optionally specify alpha for Exponential Moving Average
which is a smoothing parameter: 0 < alpha < 1 (try 0.26).
'''
"""Compute latest normalized CFTC COTR position indicators.

COTR is the Commitment of Traders Report from US gov agency.
Optionally specify alpha for Exponential Moving Average
which is a smoothing parameter: 0 < alpha < 1 (try 0.26).
"""
# For detailed derivation, see https://git.io/cotr
positions = groupget(group)
norpositions = groupfun(tool.normalize, positions)
Expand Down