StackAccel

≡ Menu

scripts

Getpivots

Getpivots (pivot-point-calculator) can be used for identifying areas of support and resistance in the next day’s trading session. Getpivots calculates pivot points for a ticker symbol using the most recent closing price data, and leverages several different algorithms which include the Floor/Classic formula, Woodie’s Formula, as well as Kirk’s formula.

getpivots-screencap1

Getpivots complements Getstockinfo in a way that I could easily incorporate into my routine.  While I’ve used spreadsheets for calculating the pivots in the past, it never really fit my workflow and always seemed to be some combination of too clunky, or too manual.   With getpivots, I can quickly check each position of interest, and get pivots and context for tomorrow’s trading session.

Expanding on pivot points for those interested, pivot points indicate price levels of significance in technical analysis, and can suggest key areas of support and resistance, as well as trade-to targets when levels are broken.  You can use them for determining the trend of a position… pivot points broken moving up, are bullish indicators.  Pivot points broken when moving down, are bearish.  Pivot points may be used in a situation where you want to put a limit order in to purchase shares in XYZ Corp., if the price breaks a pivot resistance level.  Alternatively, you might consider setting a stop-loss order if a support level is broken.

How I use it:

I use getstockinfo to get a quick summary of all of my positions and any watchlists that I’m actively tracking, and then use the summary output as an input for my homework.  One aspect of the homework is using getpivots to run though tickers of interest in getstockinfo.  In some cases, next-steps would include reviewing charts, and then possibly setting triggers to buy or sell during the next day’s trading session.  For buy and hold investors, you might use something like getpivots to help plan an entry, or exit a long-term position.  Bottom line… getpivots is a tool which can be incorporated into your routine to help provide additional insight and help with your decision making process.

Installation: pip install getpivots

Usage: Getpivots.py –t tickersymbol –f/w/k -c

Example: python getpivots.py –t tickersymbol –f

Dependencies: Python 2.7, ystockquote, yahoo_finance, regex, argparse, datetime

AD: How to Determine the Last Logon time of users

Your ability to determine last logon time really depends on the AD level that you’re at.

For information on the below attributes (and more), check here.

Pre-2003 AD: You can’t do it.
2003 AD: Look at the lastlogon attribute on all DCs.
2003 AD functional level: Look at the last-logon-timestamp
2008: Check the msDS-LastSuccessfulInteractiveLogonTime 

If you’re not at 2008, or 2003 domain functional level, and you want to determine the last logon time, you can use AD-FIND to query each DC, get the time stamp in the nt time epoch format (the time measured in seconds since 1/1/1601) and then usew32tm /ntte to convert the stamp into a readable format… Date, Hour:min:second.

adfind -h DC1:389 -b dc=domain, dc=local -f “objectcategory=person” lastlogon >DC1.txt

adfind -h DC2:389 -b dc=domain, dc=local -f “objectcategory=person” lastlogon >DC2.txt

… and so on for each DC.

To convert lastlogon time, take the time stamps for the user’s that you’re interested in and convert them…

w32tm /ntte value1
w32tm /ntte value2

… and so on.

Then you can compare each. At 2003 functional level the attribute lastlogontimestamp is replicated to each DC – so it’s a single source of truth. In 2008 it gets even better with last logons, last failed logons, and more. With some diligence, you can probably take the above steps do some further learning around them to improve things a bit, and then script the the logic. But for one-offs, and small networks this works.

Visit Us On Twitter