Is it possible with Python to code G key to move channels up and down in the Dopesheet editor?
Yes, the default keys are &#8670; Page up and &#8671; Page down, the setting can be found in keyboard input under Animation Channels.



The python path is bpy.context.window_manager.keyconfigs.active.keymaps['Animation Channels'].keymap_items['anim.channels_move'] with the property type being the key used, properties.direction is the direction the selected item is moved. You will want to loop through the keymap_items as you will find four keymap_items['anim.channels_move'] entries, up one line, down one line, to the top and to the bottom.

You should look at adding keymaps to an addon to make the changes properly.